Skip to content

Commit f22e10a

Browse files
authored
Merge pull request #197 from corenting/feat/add-kor
feat: add south korea
2 parents 01084dd + ae91d9b commit f22e10a

File tree

15 files changed

+124
-23
lines changed

15 files changed

+124
-23
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
ko_fi: corenting
2-
custom: ["https://www.buymeacoffee.com/corenting"]
1+
custom: ["https://corenting.fr/donate"]

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@ It supports the following countries :
99
- USA (from 1913 to 2022)
1010
- UK (from 1800 to 2022)
1111
- France (from 1901 to 2022)
12+
- South Korea (from 1965 to 2022)
1213

1314
## Data sources
14-
- France: INSEE, https://www.insee.fr/fr/statistiques/serie/010605954
15+
1516
- USA: Bureau of Labor Statistics (Historical CPI-U), https://www.bls.gov/cpi/
1617
- UK: Office for National Statistics, https://www.ons.gov.uk/economy/inflationandpriceindices/timeseries/cdko/mm23
18+
- France: INSEE, https://www.insee.fr/fr/statistiques/serie/010605954
19+
- 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=
1720

1821
## Download
1922

@@ -23,6 +26,4 @@ It supports the following countries :
2326

2427
## Donations
2528

26-
If you wish to support the app, donations are possible on the following platforms:
27-
- [ko-fi](https://ko-fi.com/corenting)
28-
- [buymeacoffee](https://www.buymeacoffee.com/corenting)
29+
If you wish to support the app, donations are possible [here](https://corenting.fr/donate).

app/build.gradle

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,18 @@ android {
99
applicationId "fr.corenting.convertisseureurofranc"
1010
minSdkVersion 17
1111
targetSdkVersion 34
12-
versionCode 23
13-
versionName "2.14"
12+
versionCode 24
13+
versionName "2.15"
1414
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1515
}
1616

17+
compileOptions {
18+
sourceCompatibility JavaVersion.VERSION_17
19+
targetCompatibility JavaVersion.VERSION_17
20+
}
21+
1722
kotlinOptions {
18-
jvmTarget = JavaVersion.VERSION_1_8.toString()
23+
jvmTarget = JavaVersion.VERSION_17.toString()
1924
}
2025

2126
testOptions {
@@ -51,7 +56,7 @@ dependencies {
5156
// Tests
5257
testImplementation 'androidx.test:core-ktx:1.5.0'
5358
testImplementation 'junit:junit:4.13.2'
54-
testImplementation 'org.mockito:mockito-core:5.4.0'
59+
testImplementation 'org.mockito:mockito-core:5.5.0'
5560
testImplementation "org.robolectric:robolectric:4.10.3"
5661
}
5762

app/src/main/java/fr/corenting/convertisseureurofranc/ConverterActivity.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import androidx.appcompat.widget.Toolbar
1212
import androidx.core.widget.doOnTextChanged
1313
import fr.corenting.convertisseureurofranc.converters.ConverterAbstract
1414
import fr.corenting.convertisseureurofranc.converters.FranceConverter
15+
import fr.corenting.convertisseureurofranc.converters.SouthKoreaConverter
1516
import fr.corenting.convertisseureurofranc.converters.UKConverter
1617
import fr.corenting.convertisseureurofranc.converters.USAConverter
1718
import fr.corenting.convertisseureurofranc.databinding.ActivityConverterBinding
@@ -25,6 +26,7 @@ class ConverterActivity : AppCompatActivity() {
2526
USAConverter::class.java to 0,
2627
UKConverter::class.java to 1,
2728
FranceConverter::class.java to 2,
29+
SouthKoreaConverter::class.java to 3,
2830
)
2931

3032
override fun onCreate(savedInstanceState: Bundle?) {
@@ -47,7 +49,8 @@ class ConverterActivity : AppCompatActivity() {
4749
val currenciesList = listOf(
4850
getString(R.string.usa_currencies),
4951
getString(R.string.uk_currencies),
50-
getString(R.string.france_currencies)
52+
getString(R.string.france_currencies),
53+
getString(R.string.south_korea_currencies)
5154
)
5255

5356
// Sum input
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package fr.corenting.convertisseureurofranc.converters
2+
3+
import android.content.Context
4+
5+
import fr.corenting.convertisseureurofranc.R
6+
7+
class SouthKoreaConverter(context: Context) : ConverterAbstract(context, R.raw.kr_values) {
8+
9+
override fun convertFunction(yearOfOrigin: Int, yearOfResult: Int, amount: Float): Float {
10+
if (yearOfOrigin == yearOfResult) return amount
11+
12+
val multiplier = getValueForYear(yearOfResult) / getValueForYear(yearOfOrigin)
13+
return amount * multiplier
14+
}
15+
16+
override fun getCurrencyFromYear(year: Int): String {
17+
return context.getString(R.string.wons)
18+
}
19+
}

app/src/main/java/fr/corenting/convertisseureurofranc/utils/Utils.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import android.view.inputmethod.InputMethodManager
66
import androidx.core.os.ConfigurationCompat
77
import fr.corenting.convertisseureurofranc.converters.ConverterAbstract
88
import fr.corenting.convertisseureurofranc.converters.FranceConverter
9+
import fr.corenting.convertisseureurofranc.converters.SouthKoreaConverter
910
import fr.corenting.convertisseureurofranc.converters.UKConverter
1011
import fr.corenting.convertisseureurofranc.converters.USAConverter
1112
import java.text.DecimalFormat
@@ -25,6 +26,14 @@ object Utils {
2526
UKConverter(context)
2627
}
2728

29+
Locale.US -> {
30+
USAConverter(context)
31+
}
32+
33+
Locale.KOREA -> {
34+
SouthKoreaConverter(context)
35+
}
36+
2837
else -> {
2938
USAConverter(context)
3039
}

app/src/main/res/raw/kr_values.csv

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
2022;107.7
2+
2021;102.5
3+
2020;100.0
4+
2019;99.5
5+
2018;99.1
6+
2017;97.6
7+
2016;95.8
8+
2015;94.9
9+
2014;94.2
10+
2013;93.0
11+
2012;91.8
12+
2011;89.9
13+
2010;86.4
14+
2009;83.9
15+
2008;81.7
16+
2007;78.0
17+
2006;76.1
18+
2005;74.4
19+
2004;72.4
20+
2003;69.9
21+
2002;67.5
22+
2001;65.7
23+
2000;63.2
24+
1999;61.8
25+
1998;61.3
26+
1997;57.0
27+
1996;54.6
28+
1995;52.0
29+
1994;49.8
30+
1993;46.8
31+
1992;44.7
32+
1991;42.1
33+
1990;38.5
34+
1989;35.4
35+
1988;33.5
36+
1987;31.3
37+
1986;30.4
38+
1985;29.6
39+
1984;28.8
40+
1983;28.2
41+
1982;27.3
42+
1981;25.4
43+
1980;21.0
44+
1979;16.3
45+
1978;13.8
46+
1977;12.0
47+
1976;10.9
48+
1975;9.5
49+
1974;7.6
50+
1973;6.1
51+
1972;5.9
52+
1971;5.3
53+
1970;4.7
54+
1969;4.0
55+
1968;3.6
56+
1967;3.2
57+
1966;2.9
58+
1965;2.6

app/src/main/res/values-fr/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
<string name="francs">francs</string>
1515
<string name="oldFrancs">anciens francs</string>
1616
<string name="dollars">dollars</string>
17+
<string name="wons">wons</string>
1718
<string name="currency">Devise</string>
19+
<string name="south_korea_currencies">Wons (Corée du Sud)</string>
1820
<string name="no_amount_entered">Aucun montant entré</string>
1921
<string name="usa_currencies">Dollars US (USA)</string>
2022
<string name="france_currencies">Euros et Francs (France)</string>

app/src/main/res/values/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@
1414
<string name="oldFrancs">old francs</string>
1515
<string name="dollars">dollars</string>
1616
<string name="pounds_sterling">pounds sterling</string>
17+
<string name="wons">wons</string>
1718
<string name="currency">Currency</string>
1819
<string name="france_currencies">Euros and Francs (France)</string>
1920
<string name="usa_currencies">US Dollars (USA)</string>
2021
<string name="uk_currencies">Pounds sterling (UK)</string>
22+
<string name="south_korea_currencies">Wons (South Korea)</string>
2123
<string name="no_amount_entered">No amount entered</string>
2224
<string name="theme">Theme</string>
2325
<string name="theme_light">Light</string>

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22

33
buildscript {
4-
ext.kotlin_version = '1.8.22'
4+
ext.kotlin_version = '1.9.10'
55
repositories {
66
google()
77
mavenCentral()

0 commit comments

Comments
 (0)