From ae91d9bb54698c54afcb8c9f16e9e7bfef00f1f3 Mon Sep 17 00:00:00 2001 From: Corentin Garcia Date: Wed, 13 Sep 2023 12:16:06 +0200 Subject: [PATCH] feat: add south korea --- .github/FUNDING.yml | 3 +- README.md | 9 +-- app/build.gradle | 13 +++-- .../ConverterActivity.kt | 5 +- .../converters/SouthKoreaConverter.kt | 19 ++++++ .../convertisseureurofranc/utils/Utils.kt | 9 +++ app/src/main/res/raw/kr_values.csv | 58 +++++++++++++++++++ app/src/main/res/values-fr/strings.xml | 2 + app/src/main/res/values/strings.xml | 2 + build.gradle | 2 +- .../android/en-US/full_description.txt | 11 ++-- .../android/en-US/short_description.txt | 2 +- .../android/fr-FR/full_description.txt | 9 +-- .../android/fr-FR/short_description.txt | 2 +- gradle.properties | 1 + 15 files changed, 124 insertions(+), 23 deletions(-) create mode 100644 app/src/main/java/fr/corenting/convertisseureurofranc/converters/SouthKoreaConverter.kt create mode 100644 app/src/main/res/raw/kr_values.csv diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 96cd335..dff8c08 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,2 +1 @@ -ko_fi: corenting -custom: ["https://www.buymeacoffee.com/corenting"] +custom: ["https://corenting.fr/donate"] diff --git a/README.md b/README.md index 4c4f92e..fc27202 100644 --- a/README.md +++ b/README.md @@ -9,11 +9,14 @@ It supports the following countries : - USA (from 1913 to 2022) - UK (from 1800 to 2022) - France (from 1901 to 2022) +- South Korea (from 1965 to 2022) ## Data sources -- France: INSEE, https://www.insee.fr/fr/statistiques/serie/010605954 + - USA: Bureau of Labor Statistics (Historical CPI-U), https://www.bls.gov/cpi/ - UK: Office for National Statistics, https://www.ons.gov.uk/economy/inflationandpriceindices/timeseries/cdko/mm23 +- France: INSEE, https://www.insee.fr/fr/statistiques/serie/010605954 +- South Korea: Statistics Korea (Consumer Price Inflation Rate - 소비자물가상승률), https://www.index.go.kr/unity/potal/indicator/PotalIdxSearch.do?idxCd=4226&sttsCd=422601&clas_div=&idx_sys_cd= ## Download @@ -23,6 +26,4 @@ It supports the following countries : ## Donations -If you wish to support the app, donations are possible on the following platforms: -- [ko-fi](https://ko-fi.com/corenting) -- [buymeacoffee](https://www.buymeacoffee.com/corenting) +If you wish to support the app, donations are possible [here](https://corenting.fr/donate). diff --git a/app/build.gradle b/app/build.gradle index a16897a..0d496e8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,13 +9,18 @@ android { applicationId "fr.corenting.convertisseureurofranc" minSdkVersion 17 targetSdkVersion 34 - versionCode 23 - versionName "2.14" + versionCode 24 + versionName "2.15" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } + compileOptions { + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 + } + kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8.toString() + jvmTarget = JavaVersion.VERSION_17.toString() } testOptions { @@ -51,7 +56,7 @@ dependencies { // Tests testImplementation 'androidx.test:core-ktx:1.5.0' testImplementation 'junit:junit:4.13.2' - testImplementation 'org.mockito:mockito-core:5.4.0' + testImplementation 'org.mockito:mockito-core:5.5.0' testImplementation "org.robolectric:robolectric:4.10.3" } diff --git a/app/src/main/java/fr/corenting/convertisseureurofranc/ConverterActivity.kt b/app/src/main/java/fr/corenting/convertisseureurofranc/ConverterActivity.kt index d63b5a2..79a4ac9 100644 --- a/app/src/main/java/fr/corenting/convertisseureurofranc/ConverterActivity.kt +++ b/app/src/main/java/fr/corenting/convertisseureurofranc/ConverterActivity.kt @@ -12,6 +12,7 @@ import androidx.appcompat.widget.Toolbar import androidx.core.widget.doOnTextChanged import fr.corenting.convertisseureurofranc.converters.ConverterAbstract import fr.corenting.convertisseureurofranc.converters.FranceConverter +import fr.corenting.convertisseureurofranc.converters.SouthKoreaConverter import fr.corenting.convertisseureurofranc.converters.UKConverter import fr.corenting.convertisseureurofranc.converters.USAConverter import fr.corenting.convertisseureurofranc.databinding.ActivityConverterBinding @@ -25,6 +26,7 @@ class ConverterActivity : AppCompatActivity() { USAConverter::class.java to 0, UKConverter::class.java to 1, FranceConverter::class.java to 2, + SouthKoreaConverter::class.java to 3, ) override fun onCreate(savedInstanceState: Bundle?) { @@ -47,7 +49,8 @@ class ConverterActivity : AppCompatActivity() { val currenciesList = listOf( getString(R.string.usa_currencies), getString(R.string.uk_currencies), - getString(R.string.france_currencies) + getString(R.string.france_currencies), + getString(R.string.south_korea_currencies) ) // Sum input diff --git a/app/src/main/java/fr/corenting/convertisseureurofranc/converters/SouthKoreaConverter.kt b/app/src/main/java/fr/corenting/convertisseureurofranc/converters/SouthKoreaConverter.kt new file mode 100644 index 0000000..52837aa --- /dev/null +++ b/app/src/main/java/fr/corenting/convertisseureurofranc/converters/SouthKoreaConverter.kt @@ -0,0 +1,19 @@ +package fr.corenting.convertisseureurofranc.converters + +import android.content.Context + +import fr.corenting.convertisseureurofranc.R + +class SouthKoreaConverter(context: Context) : ConverterAbstract(context, R.raw.kr_values) { + + override fun convertFunction(yearOfOrigin: Int, yearOfResult: Int, amount: Float): Float { + if (yearOfOrigin == yearOfResult) return amount + + val multiplier = getValueForYear(yearOfResult) / getValueForYear(yearOfOrigin) + return amount * multiplier + } + + override fun getCurrencyFromYear(year: Int): String { + return context.getString(R.string.wons) + } +} diff --git a/app/src/main/java/fr/corenting/convertisseureurofranc/utils/Utils.kt b/app/src/main/java/fr/corenting/convertisseureurofranc/utils/Utils.kt index 5f2227c..85a70c3 100644 --- a/app/src/main/java/fr/corenting/convertisseureurofranc/utils/Utils.kt +++ b/app/src/main/java/fr/corenting/convertisseureurofranc/utils/Utils.kt @@ -6,6 +6,7 @@ import android.view.inputmethod.InputMethodManager import androidx.core.os.ConfigurationCompat import fr.corenting.convertisseureurofranc.converters.ConverterAbstract import fr.corenting.convertisseureurofranc.converters.FranceConverter +import fr.corenting.convertisseureurofranc.converters.SouthKoreaConverter import fr.corenting.convertisseureurofranc.converters.UKConverter import fr.corenting.convertisseureurofranc.converters.USAConverter import java.text.DecimalFormat @@ -25,6 +26,14 @@ object Utils { UKConverter(context) } + Locale.US -> { + USAConverter(context) + } + + Locale.KOREA -> { + SouthKoreaConverter(context) + } + else -> { USAConverter(context) } diff --git a/app/src/main/res/raw/kr_values.csv b/app/src/main/res/raw/kr_values.csv new file mode 100644 index 0000000..081888f --- /dev/null +++ b/app/src/main/res/raw/kr_values.csv @@ -0,0 +1,58 @@ +2022;107.7 +2021;102.5 +2020;100.0 +2019;99.5 +2018;99.1 +2017;97.6 +2016;95.8 +2015;94.9 +2014;94.2 +2013;93.0 +2012;91.8 +2011;89.9 +2010;86.4 +2009;83.9 +2008;81.7 +2007;78.0 +2006;76.1 +2005;74.4 +2004;72.4 +2003;69.9 +2002;67.5 +2001;65.7 +2000;63.2 +1999;61.8 +1998;61.3 +1997;57.0 +1996;54.6 +1995;52.0 +1994;49.8 +1993;46.8 +1992;44.7 +1991;42.1 +1990;38.5 +1989;35.4 +1988;33.5 +1987;31.3 +1986;30.4 +1985;29.6 +1984;28.8 +1983;28.2 +1982;27.3 +1981;25.4 +1980;21.0 +1979;16.3 +1978;13.8 +1977;12.0 +1976;10.9 +1975;9.5 +1974;7.6 +1973;6.1 +1972;5.9 +1971;5.3 +1970;4.7 +1969;4.0 +1968;3.6 +1967;3.2 +1966;2.9 +1965;2.6 \ No newline at end of file diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 42d8b63..5c190d8 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -14,7 +14,9 @@ francs anciens francs dollars + wons Devise + Wons (Corée du Sud) Aucun montant entré Dollars US (USA) Euros et Francs (France) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9a66460..da42b5b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -14,10 +14,12 @@ old francs dollars pounds sterling + wons Currency Euros and Francs (France) US Dollars (USA) Pounds sterling (UK) + Wons (South Korea) No amount entered Theme Light diff --git a/build.gradle b/build.gradle index 16f0152..d2c627f 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.8.22' + ext.kotlin_version = '1.9.10' repositories { google() mavenCentral() diff --git a/fastlane/metadata/android/en-US/full_description.txt b/fastlane/metadata/android/en-US/full_description.txt index 76187a2..242af76 100644 --- a/fastlane/metadata/android/en-US/full_description.txt +++ b/fastlane/metadata/android/en-US/full_description.txt @@ -1,6 +1,7 @@ -This converter allows you to calculate the buying power in a specified year of any amount of money (for USA, UK and France) to an equivalent amount in another year by taking into account the inflation rate between these two years.
+This converter allows you to calculate the buying power in a specified year of any amount of money (for USA, UK, France and South Korea) to an equivalent amount in another year by taking into account the inflation rate between these two years.
-To achieve this, this app uses data from various sources : -- The Bureau of Labor Statistics (https://www.bls.gov/cpi/) for the USA -- The Office for National Statistics (https://www.ons.gov.uk/economy/inflationandpriceindices/timeseries/cdko/mm23) for the UK -- The INSEE (https://www.insee.fr/fr/statistiques/serie/001643154) for France +To achieve this, this application uses data from various sources : +- USA: Bureau of Labor Statistics (Historical CPI-U), https://www.bls.gov/cpi/ +- UK: Office for National Statistics, https://www.ons.gov.uk/economy/inflationandpriceindices/timeseries/cdko/mm23 +- France: INSEE, https://www.insee.fr/fr/statistiques/serie/010605954 +- South Korea: Statistics Korea (Consumer Price Inflation Rate - 소비자물가상승률), https://www.index.go.kr/unity/potal/indicator/PotalIdxSearch.do?idxCd=4226&sttsCd=422601&clas_div=&idx_sys_cd= \ No newline at end of file diff --git a/fastlane/metadata/android/en-US/short_description.txt b/fastlane/metadata/android/en-US/short_description.txt index 03905ee..b60c716 100644 --- a/fastlane/metadata/android/en-US/short_description.txt +++ b/fastlane/metadata/android/en-US/short_description.txt @@ -1 +1 @@ -Inflation calculator for USA, UK and France \ No newline at end of file +Inflation calculator for various countries \ No newline at end of file diff --git a/fastlane/metadata/android/fr-FR/full_description.txt b/fastlane/metadata/android/fr-FR/full_description.txt index 3b76a9c..94f2b16 100644 --- a/fastlane/metadata/android/fr-FR/full_description.txt +++ b/fastlane/metadata/android/fr-FR/full_description.txt @@ -1,6 +1,7 @@ -Ce calculateur d'inflation permet de calculer le pouvoir d'achat d'une somme (France, USA ou UK) d’une année donnée en une somme équivalente d’une autre année, en prenant en compte l’inflation entre ces deux années.
+Ce calculateur d'inflation permet de calculer le pouvoir d'achat d'une somme (France, USA, UK et Corée du Sud) d’une année donnée en une somme équivalente d’une autre année, en prenant en compte l’inflation entre ces deux années.
Pour cela, cette application utilise les donnée de plusieurs sources : -- Bureau of Labor Statistics (https://www.bls.gov/cpi/) pour les USA -- Office for National Statistics (https://www.ons.gov.uk/economy/inflationandpriceindices/timeseries/cdko/mm23) pour le Royaume-Uni -- INSEE (https://www.insee.fr/fr/statistiques/serie/001643154) pour la France \ No newline at end of file +- USA : Bureau of Labor Statistics (Historical CPI-U), https://www.bls.gov/cpi/ +- UK : Office for National Statistics, https://www.ons.gov.uk/economy/inflationandpriceindices/timeseries/cdko/mm23 +- France : INSEE, https://www.insee.fr/fr/statistiques/serie/010605954 +- Corée du Sud : Statistics Korea (Consumer Price Inflation Rate - 소비자물가상승률), https://www.index.go.kr/unity/potal/indicator/PotalIdxSearch.do?idxCd=4226&sttsCd=422601&clas_div=&idx_sys_cd= \ No newline at end of file diff --git a/fastlane/metadata/android/fr-FR/short_description.txt b/fastlane/metadata/android/fr-FR/short_description.txt index fda8705..b955a9f 100644 --- a/fastlane/metadata/android/fr-FR/short_description.txt +++ b/fastlane/metadata/android/fr-FR/short_description.txt @@ -1 +1 @@ -Calculateur d'inflation pour la France, les USA et le Royaume-Uni \ No newline at end of file +Calculateur d'inflation pour plusieurs pays \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 244b865..b5e37ef 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,4 @@ +org.gradle.jvmargs=-Xmx1536m android.useAndroidX=true android.defaults.buildfeatures.buildconfig=true android.nonTransitiveRClass=true