diff --git a/app/build.gradle b/app/build.gradle index 994fe86..09e68fc 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,14 +3,14 @@ apply plugin: 'kotlin-android' android { compileSdkVersion 33 - buildToolsVersion "33.0.0" + buildToolsVersion "33.0.1" defaultConfig { applicationId "fr.corenting.convertisseureurofranc" minSdkVersion 17 targetSdkVersion 33 - versionCode 20 - versionName "2.11" + versionCode 21 + versionName "2.12" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/src/main/java/fr/corenting/convertisseureurofranc/ConverterActivity.kt b/app/src/main/java/fr/corenting/convertisseureurofranc/ConverterActivity.kt index bccf273..801d32c 100644 --- a/app/src/main/java/fr/corenting/convertisseureurofranc/ConverterActivity.kt +++ b/app/src/main/java/fr/corenting/convertisseureurofranc/ConverterActivity.kt @@ -8,6 +8,7 @@ import android.widget.Toast import androidx.activity.viewModels import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatDelegate +import androidx.appcompat.widget.Toolbar import androidx.core.widget.doOnTextChanged import fr.corenting.convertisseureurofranc.converters.ConverterAbstract import fr.corenting.convertisseureurofranc.converters.FranceConverter @@ -31,6 +32,10 @@ class ConverterActivity : AppCompatActivity() { AppCompatDelegate.setDefaultNightMode(ThemeUtils.getThemeToUse(this)) super.onCreate(savedInstanceState) + // Set toolbar + val toolbar = findViewById(R.id.topAppBar) + setSupportActionBar(toolbar) + // Binding and view binding = ActivityConverterBinding.inflate(layoutInflater) val view = binding.root @@ -64,16 +69,16 @@ class ConverterActivity : AppCompatActivity() { onConverterChange(it) // Update selected in list (used at app opening) - binding.currencyAutoComplete.setText( + binding.currencyTextView.setText( currenciesList[converters[it::class.java] ?: 0] ) } } //Set currency spinner content - val adapter = AutoCompleteAdapter(this, R.layout.list_item, currenciesList) - binding.currencyAutoComplete.setAdapter(adapter) - binding.currencyAutoComplete.setOnItemClickListener { _, _, position, _ -> + val adapter = DropdownAdapter(this, R.layout.list_item, currenciesList) + binding.currencyTextView.setAdapter(adapter) + binding.currencyTextView.setOnItemClickListener { _, _, position, _ -> val converterClass = converters.entries.associate { (key, value) -> value to key }[position] @@ -89,13 +94,13 @@ class ConverterActivity : AppCompatActivity() { val latestYear = newConverter.latestYear val firstYear = newConverter.firstYear - binding.yearOfOriginAutoComplete.setText(latestYear.toString()) + binding.yearOfOriginEditText.setText(latestYear.toString()) binding.yearOfOriginInput.hint = getString(R.string.yearOfOrigin, firstYear, latestYear) - binding.yearOfOriginAutoComplete.doOnTextChanged { text, _, _, _ -> + binding.yearOfOriginEditText.doOnTextChanged { text, _, _, _ -> YearInputTextHandler.doOnTextChanged( applicationContext, newConverter, - binding.yearOfOriginAutoComplete, + binding.yearOfOriginEditText, binding.yearOfOriginInput ) try { @@ -111,13 +116,13 @@ class ConverterActivity : AppCompatActivity() { newConverter.getCurrencyFromYear(latestYear) ) - binding.yearOfResultAutoComplete.setText(latestYear.toString()) + binding.yearOfResultEditText.setText(latestYear.toString()) binding.yearOfResultInput.hint = getString(R.string.yearOfResult, firstYear, latestYear) - binding.yearOfResultAutoComplete.doOnTextChanged { text, _, _, _ -> + binding.yearOfResultEditText.doOnTextChanged { text, _, _, _ -> YearInputTextHandler.doOnTextChanged( applicationContext, newConverter, - binding.yearOfResultAutoComplete, + binding.yearOfResultEditText, binding.yearOfResultInput ) try { @@ -173,8 +178,8 @@ class ConverterActivity : AppCompatActivity() { binding.convertButton.setOnClickListener { v -> binding.convertButton.requestFocus() binding.sumToConvertInput.clearFocus() - binding.yearOfOriginAutoComplete.clearFocus() - binding.yearOfResultAutoComplete.clearFocus() + binding.yearOfOriginEditText.clearFocus() + binding.yearOfResultEditText.clearFocus() Utils.hideSoftKeyboard(v) doConversion(converterViewModel) } @@ -184,9 +189,9 @@ class ConverterActivity : AppCompatActivity() { try { binding.sumToConvertInput.error = null val yearOfOrigin = - Integer.parseInt(binding.yearOfOriginAutoComplete.text.toString()) + Integer.parseInt(binding.yearOfOriginEditText.text.toString()) val yearOfResult = - Integer.parseInt(binding.yearOfResultAutoComplete.text.toString()) + Integer.parseInt(binding.yearOfResultEditText.text.toString()) val amount = java.lang.Float.parseFloat(binding.sumToConvertText.text.toString()) val convertedAmount = converterViewModel.doConversion(yearOfOrigin, yearOfResult, amount) diff --git a/app/src/main/java/fr/corenting/convertisseureurofranc/AutoCompleteAdapter.kt b/app/src/main/java/fr/corenting/convertisseureurofranc/DropdownAdapter.kt similarity index 86% rename from app/src/main/java/fr/corenting/convertisseureurofranc/AutoCompleteAdapter.kt rename to app/src/main/java/fr/corenting/convertisseureurofranc/DropdownAdapter.kt index c232b08..4439c4a 100644 --- a/app/src/main/java/fr/corenting/convertisseureurofranc/AutoCompleteAdapter.kt +++ b/app/src/main/java/fr/corenting/convertisseureurofranc/DropdownAdapter.kt @@ -5,7 +5,7 @@ import android.widget.ArrayAdapter import android.widget.Filter -class AutoCompleteAdapter(context: Context, resource: Int, objects: List) : +class DropdownAdapter(context: Context, resource: Int, objects: List) : ArrayAdapter(context, resource, objects) { override fun getFilter(): Filter { diff --git a/app/src/main/res/layout/activity_converter.xml b/app/src/main/res/layout/activity_converter.xml index bb1fd0c..65047da 100644 --- a/app/src/main/res/layout/activity_converter.xml +++ b/app/src/main/res/layout/activity_converter.xml @@ -9,14 +9,13 @@ + app:popupTheme="@style/ThemeOverlay.Material3.Light" + app:title="@string/appName" /> @@ -26,8 +25,8 @@ app:layout_behavior="@string/appbar_scrolling_view_behavior"> @@ -83,10 +82,9 @@ app:startIconDrawable="@drawable/calendar"> @@ -102,8 +100,8 @@ android:hint="@string/yearOfResult" app:startIconDrawable="@drawable/calendar"> - diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml deleted file mode 100644 index 15bf231..0000000 --- a/app/src/main/res/values-night/colors.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - #607d8b - #34515e - #F48FB1 - #E91E63 - - #34515e - \ No newline at end of file diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml new file mode 100644 index 0000000..2a2feff --- /dev/null +++ b/app/src/main/res/values-night/themes.xml @@ -0,0 +1,6 @@ + + + + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 59b6721..e937fc1 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,9 +1,4 @@ - - #03A9F4 - #0288D1 - #F48FB1 - #E91E63 - - #0288D1 - \ No newline at end of file + #03A9F4 + #006493 + diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 8c4e688..35b7283 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -1,15 +1,7 @@ - - + + - \ No newline at end of file + diff --git a/fastlane/metadata/android/en-US/changelogs/21.txt b/fastlane/metadata/android/en-US/changelogs/21.txt new file mode 100644 index 0000000..4346fba --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/21.txt @@ -0,0 +1 @@ +Update theme \ No newline at end of file diff --git a/fastlane/metadata/android/fr-FR/changelogs/21.txt b/fastlane/metadata/android/fr-FR/changelogs/21.txt new file mode 100644 index 0000000..9a6cde7 --- /dev/null +++ b/fastlane/metadata/android/fr-FR/changelogs/21.txt @@ -0,0 +1 @@ +Mise à jour du thème \ No newline at end of file