Merge branch 'fix_data_lost_during_rotation' into dev-axel-saveInstanceState

This commit is contained in:
Axel Labarre 2023-02-22 15:50:06 +01:00
commit 709df3fa87
20 changed files with 301 additions and 241 deletions

View File

@ -1,6 +1,11 @@
Changelog
==========
Version 5.11.2 *(2023-02-10)*
----------------------------
* Added some UI, translation and stability improvements
Version 5.11.1 *(2023-01-04)*
----------------------------

8
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,8 @@
### Reporting
Before you report something, read the reporting rules [here](https://github.com/SimpleMobileTools/General-Discussion#how-do-i-suggest-an-improvement-ask-a-question-or-report-an-issue) please.
### Contributing as a developer
Some instructions about code style and everything that has to be done to increase the change of your code getting accepted can be found at the [General Discussion](https://github.com/SimpleMobileTools/General-Discussion#contribution-rules-for-developers) section.
### Contributing as a non developer
In case you just want to for example improve a translation, you can find the way of doing it [here](https://github.com/SimpleMobileTools/General-Discussion#how-can-i-suggest-an-edit-to-a-file).

View File

@ -16,8 +16,8 @@ android {
applicationId "com.simplemobiletools.calculator"
minSdkVersion 23
targetSdkVersion 33
versionCode 58
versionName "5.11.1"
versionCode 59
versionName "5.11.2"
setProperty("archivesBaseName", "calculator")
}
@ -63,11 +63,11 @@ android {
}
dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:48be8434c3'
implementation 'com.github.SimpleMobileTools:Simple-Commons:c457573200'
implementation 'me.grantland:autofittextview:0.2.1'
implementation 'net.objecthunter:exp4j:0.4.8'
kapt 'androidx.room:room-compiler:2.4.3'
implementation 'androidx.room:room-runtime:2.4.3'
annotationProcessor 'androidx.room:room-compiler:2.4.3'
kapt 'androidx.room:room-compiler:2.5.0'
implementation 'androidx.room:room-runtime:2.5.0'
annotationProcessor 'androidx.room:room-compiler:2.5.0'
}

View File

@ -46,12 +46,16 @@ class MainActivity : SimpleActivity(), Calculator {
private lateinit var calc: CalculatorImpl
override fun onCreate(savedInstanceState: Bundle?) {
isMaterialActivity = true
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
appLaunched(BuildConfig.APPLICATION_ID)
setupOptionsMenu()
refreshMenuItems()
updateMaterialActivityViews(main_coordinator, null, useTransparentNavigation = false, useTopSearchMenu = false)
setupMaterialScrollListener(main_nested_scrollview, main_toolbar)
//============================================================
if(savedInstanceState != null) {
@ -293,6 +297,6 @@ class MainActivity : SimpleActivity(), Calculator {
bundle.putDouble("savedBaseValue", calc.baseValue)
bundle.putDouble("savedSecondValue", calc.getSecondValueV2())
bundle.putString("savedInputDisplayedFormula", calc.inputDisplayedFormula)
}
//============================================================
}

View File

@ -226,7 +226,7 @@ class CalculatorImpl(
lastKey = EQUALS
}
public fun getSecondValue(): Double {
private fun getSecondValue(): Double {
val valueToCheck = inputDisplayedFormula.trimStart('-').removeGroupSeparator()
Log.v("VALUEToCheck GETSV :", valueToCheck)
@ -258,7 +258,11 @@ class CalculatorImpl(
return
}
baseValue = parts.first().toDouble()
try {
baseValue = parts.first().toDouble()
} catch (e: NumberFormatException) {
context.showErrorToast(e)
}
if (inputDisplayedFormula.startsWith("-")) {
baseValue *= -1

View File

@ -16,239 +16,247 @@
app:menu="@menu/menu"
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
<LinearLayout
android:id="@+id/calculator_holder"
<androidx.core.widget.NestedScrollView
android:id="@+id/main_nested_scrollview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="?attr/actionBarSize"
android:hapticFeedbackEnabled="true"
android:layoutDirection="ltr"
android:orientation="vertical">
<TextView
android:id="@+id/formula"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="2.1"
android:fontFamily="sans-serif-light"
android:gravity="end|bottom"
android:maxLines="1"
android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin"
android:textSize="@dimen/formula_text_size" />
<TextView
android:id="@+id/result"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1.8"
android:fontFamily="sans-serif-light"
android:gravity="center_vertical|end"
android:maxLines="1"
android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin"
android:textSize="@dimen/display_text_size"
tools:text="0" />
android:fillViewport="true"
android:scrollbars="none">
<LinearLayout
android:id="@+id/calculator_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="2"
android:orientation="horizontal">
android:hapticFeedbackEnabled="true"
android:layoutDirection="ltr"
android:orientation="vertical">
<TextView
android:id="@+id/btn_7"
style="@style/MyButton"
android:id="@+id/formula"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="7" />
android:layout_weight="2.1"
android:fontFamily="sans-serif-light"
android:gravity="end|bottom"
android:maxLines="1"
android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin"
android:textSize="@dimen/formula_text_size" />
<TextView
android:id="@+id/btn_8"
style="@style/MyButton"
android:id="@+id/result"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="8" />
android:layout_weight="1.8"
android:fontFamily="sans-serif-light"
android:gravity="center_vertical|end"
android:maxLines="1"
android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin"
android:textSize="@dimen/display_text_size"
tools:text="0" />
<TextView
android:id="@+id/btn_9"
style="@style/MyButton"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="9" />
android:layout_weight="2"
android:orientation="horizontal">
<TextView
android:id="@+id/btn_divide"
style="@style/MyButton"
<TextView
android:id="@+id/btn_7"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="7" />
<TextView
android:id="@+id/btn_8"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="8" />
<TextView
android:id="@+id/btn_9"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="9" />
<TextView
android:id="@+id/btn_divide"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="÷" />
<TextView
android:id="@+id/btn_clear"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="C" />
<TextView
android:id="@+id/btn_reset"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="AC"
android:visibility="gone" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="÷" />
android:layout_weight="2"
android:orientation="horizontal">
<TextView
android:id="@+id/btn_clear"
style="@style/MyButton"
<TextView
android:id="@+id/btn_4"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="4" />
<TextView
android:id="@+id/btn_5"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="5" />
<TextView
android:id="@+id/btn_6"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="6" />
<TextView
android:id="@+id/btn_multiply"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="×" />
<TextView
android:id="@+id/btn_root"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="√" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="C" />
android:layout_weight="2"
android:orientation="horizontal">
<TextView
android:id="@+id/btn_reset"
style="@style/MyButton"
<TextView
android:id="@+id/btn_1"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="1" />
<TextView
android:id="@+id/btn_2"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="2" />
<TextView
android:id="@+id/btn_3"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="3" />
<TextView
android:id="@+id/btn_minus"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="-" />
<TextView
android:id="@+id/btn_power"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="^" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="AC"
android:visibility="gone" />
android:layout_weight="2"
android:orientation="horizontal">
<TextView
android:id="@+id/btn_0"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="0" />
<TextView
android:id="@+id/btn_decimal"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="." />
<TextView
android:id="@+id/btn_equals"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="=" />
<TextView
android:id="@+id/btn_plus"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="+" />
<TextView
android:id="@+id/btn_percent"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="%" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="2"
android:orientation="horizontal">
<TextView
android:id="@+id/btn_4"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="4" />
<TextView
android:id="@+id/btn_5"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="5" />
<TextView
android:id="@+id/btn_6"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="6" />
<TextView
android:id="@+id/btn_multiply"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="×" />
<TextView
android:id="@+id/btn_root"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="√" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="2"
android:orientation="horizontal">
<TextView
android:id="@+id/btn_1"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="1" />
<TextView
android:id="@+id/btn_2"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="2" />
<TextView
android:id="@+id/btn_3"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="3" />
<TextView
android:id="@+id/btn_minus"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="-" />
<TextView
android:id="@+id/btn_power"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="^" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="2"
android:orientation="horizontal">
<TextView
android:id="@+id/btn_0"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="0" />
<TextView
android:id="@+id/btn_decimal"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="." />
<TextView
android:id="@+id/btn_equals"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="=" />
<TextView
android:id="@+id/btn_plus"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="+" />
<TextView
android:id="@+id/btn_percent"
style="@style/MyButton"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="%" />
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -16,10 +16,18 @@
app:menu="@menu/menu"
app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" />
<include
layout="@layout/view_calculator"
<androidx.core.widget.NestedScrollView
android:id="@+id/main_nested_scrollview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="?attr/actionBarSize" />
android:layout_marginTop="?attr/actionBarSize"
android:fillViewport="true"
android:scrollbars="none">
<include
layout="@layout/view_calculator"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -1,16 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="AlwaysShowAction">
<item
android:id="@+id/history"
android:icon="@drawable/ic_clock_vector"
android:title="@string/history"
app:showAsAction="always" />
<item
android:id="@+id/more_apps_from_us"
android:icon="@drawable/ic_google_play_vector"
android:title="@string/more_apps_from_us"
app:showAsAction="always" />
<item
android:id="@+id/settings"
android:icon="@drawable/ic_settings_cog_vector"
@ -21,4 +18,8 @@
android:icon="@drawable/ic_info_vector"
android:title="@string/about"
app:showAsAction="always" />
<item
android:id="@+id/more_apps_from_us"
android:title="@string/more_apps_from_us"
app:showAsAction="never" />
</menu>

View File

@ -2,22 +2,22 @@
<resources>
<string name="app_name">Simple Calculator</string>
<string name="app_launcher_name">Calculadora</string>
<string name="scientific_calculator">Calculadora Científica</string>
<string name="scientific_calculator">Calculadora científica</string>
<!-- Calculator field -->
<string name="formula_divide_by_zero_error">Error: división por cero</string>
<!-- History -->
<string name="history">Historial</string>
<string name="history_empty">El historial está vacío</string>
<string name="clear_history">Vaciar</string>
<string name="history_cleared">El historial ha sido vaciado</string>
<string name="clear_history">Borrar</string>
<string name="history_cleared">El historial ha sido borrado</string>
<!-- Settings -->
<string name="vibrate_on_button_press">Vibrar al presionar un botón</string>
<string name="use_comma_as_decimal_mark">Usa una coma como marca decimal</string>
<string name="use_comma_as_decimal_mark">Usar una coma como marca decimal</string>
<!-- FAQ -->
<string name="faq_1_title">¿Cómo funciona el botón C (Clear: Limpiar)?</string>
<string name="faq_1_text">Presionándolo una vez eliminará un solo caracter. Mantenerlo presionado reiniciará todos los campos.</string>
<string name="faq_1_title">¿Cómo funciona el botón C (Borrar)\?</string>
<string name="faq_1_text">Presionándolo una vez eliminará un solo carácter. Mantenerlo presionado reiniciará todos los campos.</string>
<!--
Haven't found some strings? There's more at
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
-->
</resources>
</resources>

View File

@ -7,7 +7,7 @@
<string name="formula_divide_by_zero_error">Klaida: dalyba iš nulio</string>
<!-- History -->
<string name="history">Istorija</string>
<string name="history_empty">Istorija tuščia</string>
<string name="history_empty">Istorija yra tuščia</string>
<string name="clear_history">Išvalyti</string>
<string name="history_cleared">Istorija išvalyta</string>
<!-- Settings -->

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">ⵜⴰⵙⵎⵙⵙⵉⴹⵏⵜ ⵜⴰⴼⵔⴰⵔⵜ</string>
<string name="app_launcher_name">ⵜⴰⵙⵎⵙⵙⵉⴹⵏⵜ</string>
<string name="scientific_calculator">ⵜⴰⵙⵎⵙⵙⵉⴹⵏⵜ ⵜⴰⵎⴰⵙⵙⴰⵏⵜ</string>
<!-- Calculator field -->
<string name="formula_divide_by_zero_error">ⵜⴰⵣⴳⵍⵜ: ⴰⴱⵟⵟⵓ ⵅⴼ ⵓⵎⵢⴰ</string>
<!-- History -->
<string name="history">ⴰⵎⵣⵔⵓⵢ</string>
<string name="history_empty">ⴰⵎⵣⵔⵓⵢ ⵢⵓⵔⴰ</string>
<string name="clear_history">ⴽⴽⵙ</string>
<string name="history_cleared">ⵉⵜⵜⵡⴰⴽⴽⵙ ⵓⵎⵣⵔⵓⵢ</string>
<!-- Settings -->
<string name="vibrate_on_button_press">ⴰⵔⵎⵉⵎⵎⵉ ⴳ ⵡⴰⴱⴱⴰⵥ ⵅⴼ ⵜⴳⵎⵎⵓⵜⵉⵏ</string>
<string name="use_comma_as_decimal_mark">ⵙⵎⵔⵙ ⵜⵉⵙⴽⵔⵜ ⴷ ⵜⴰⵎⴰⵜⴰⵔⵜ ⵜⴰⵎⵔⴰⵡⴰⵏⵜ</string>
<!-- FAQ -->
<string name="faq_1_title">ⵎⴰⵎⴽ ⵜⵙⵡⵓⵔⵓⵢ ⵜⴳⵎⵎⵓⵜ C (ⴽⴽⵙ)\?</string>
<string name="faq_1_text">ⴰⴱⴱⴰⵥ ⵅⴼ ⵓⵢⵏⵏⴰ ⴰⴷ ⵉⴽⴽⵙ ⵢⴰⵏ ⵓⵙⴽⴽⵉⵍ ⴳ ⵢⴰⵏ ⵓⵣⵎⵣ. ⵎⵛ ⵉⵍⵍⴰ ⵡⴰⴱⴱⴰⵥ ⴰⵙⵓⵍⴰⵏ ⵔⴰⴷ ⵜⵜⵓⵙⵏⴼⵍⵏ ⵎⴰⵕⵕⴰ ⵉⴳⵔⴰⵏ ⴳ ⵢⴰⵏ ⵓⵣⵎⵣ.</string>
</resources>

View File

@ -0,0 +1 @@
* Added some UI, translation and stability improvements

View File

@ -32,4 +32,4 @@ Reddit:
https://www.reddit.com/r/SimpleMobileTools
Telegram:
https://t.me/SimpleMobileTools
https://t.me/SimpleMobileTools

View File

@ -1 +1 @@
Skaičiuotuvas su pagrindinėmis funkcijomis ir pritaikomu skydeliu.
Skaičiuotuvas su pagrindinėmis funkcijomis ir derinama naudotojo sąsaja

View File

@ -1 +1 @@
Paprastas skaičiuotuvas
Paprastas skaičiuotuvas

View File

@ -0,0 +1 @@
Uma linda calculadora para calculos rápidos com uma interface de usuário suave

View File

@ -0,0 +1 @@
Calculadora Simples

View File

@ -25,11 +25,11 @@
Ознакомьтесь с полным набором простых инструментов здесь:
https://www.simplemobiletools.com
Фейсбук:
Facebook:
https://www.facebook.com/simplemobiletools
Реддит:
Reddit:
https://www.reddit.com/r/SimpleMobileTools
Телеграмма:
https://t.me/SimpleMobileTools
Telegram:
https://t.me/SimpleMobileTools

View File

@ -1 +1 @@
калькулятор для быстрых простых вычислений с плавным пользовательским
калькулятор для быстрых простых вычислений с плавным пользовательским

View File

@ -1 +1 @@
Простой калькулятор
Простой калькулятор