Skip to content

Commit

Permalink
Merge pull request #197 from corenting/feat/add-kor
Browse files Browse the repository at this point in the history
feat: add south korea
  • Loading branch information
corenting authored Sep 13, 2023
2 parents 01084dd + ae91d9b commit f22e10a
Show file tree
Hide file tree
Showing 15 changed files with 124 additions and 23 deletions.
3 changes: 1 addition & 2 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
ko_fi: corenting
custom: ["https://www.buymeacoffee.com/corenting"]
custom: ["https://corenting.fr/donate"]
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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).
13 changes: 9 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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?) {
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -25,6 +26,14 @@ object Utils {
UKConverter(context)
}

Locale.US -> {
USAConverter(context)
}

Locale.KOREA -> {
SouthKoreaConverter(context)
}

else -> {
USAConverter(context)
}
Expand Down
58 changes: 58 additions & 0 deletions app/src/main/res/raw/kr_values.csv
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
<string name="francs">francs</string>
<string name="oldFrancs">anciens francs</string>
<string name="dollars">dollars</string>
<string name="wons">wons</string>
<string name="currency">Devise</string>
<string name="south_korea_currencies">Wons (Corée du Sud)</string>
<string name="no_amount_entered">Aucun montant entré</string>
<string name="usa_currencies">Dollars US (USA)</string>
<string name="france_currencies">Euros et Francs (France)</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
<string name="oldFrancs">old francs</string>
<string name="dollars">dollars</string>
<string name="pounds_sterling">pounds sterling</string>
<string name="wons">wons</string>
<string name="currency">Currency</string>
<string name="france_currencies">Euros and Francs (France)</string>
<string name="usa_currencies">US Dollars (USA)</string>
<string name="uk_currencies">Pounds sterling (UK)</string>
<string name="south_korea_currencies">Wons (South Korea)</string>
<string name="no_amount_entered">No amount entered</string>
<string name="theme">Theme</string>
<string name="theme_light">Light</string>
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
11 changes: 6 additions & 5 deletions fastlane/metadata/android/en-US/full_description.txt
Original file line number Diff line number Diff line change
@@ -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.<br />
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.<br />

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=
2 changes: 1 addition & 1 deletion fastlane/metadata/android/en-US/short_description.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Inflation calculator for USA, UK and France
Inflation calculator for various countries
9 changes: 5 additions & 4 deletions fastlane/metadata/android/fr-FR/full_description.txt
Original file line number Diff line number Diff line change
@@ -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.<br />
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.<br />

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
- 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=
2 changes: 1 addition & 1 deletion fastlane/metadata/android/fr-FR/short_description.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Calculateur d'inflation pour la France, les USA et le Royaume-Uni
Calculateur d'inflation pour plusieurs pays
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
org.gradle.jvmargs=-Xmx1536m
android.useAndroidX=true
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=true
Expand Down

0 comments on commit f22e10a

Please sign in to comment.