Merge pull request #1 from ochagovdanil/feature_divide_by_zero_message
Feature divide by zero message
This commit is contained in:
commit
3b5dc90e86
|
@ -56,15 +56,23 @@ class CalculatorImpl(calculator: Calculator, val context: Context) {
|
|||
val second = secondValue.format()
|
||||
val sign = getSign(lastOperation)
|
||||
|
||||
if (sign == "√") {
|
||||
setFormula(sign + first)
|
||||
} else if (sign == "!") {
|
||||
setFormula(first + sign)
|
||||
} else if (!sign.isEmpty()) {
|
||||
var formula = first + sign + second
|
||||
when {
|
||||
baseValue == 0.0 && secondValue == 0.0 && sign == "/" -> {
|
||||
setFormula(context.getString(R.string.formula_divide_by_zero_error))
|
||||
}
|
||||
|
||||
sign == "√" -> setFormula(sign + first)
|
||||
|
||||
sign == "!" -> setFormula(first + sign)
|
||||
|
||||
else -> {
|
||||
if (sign.isNotEmpty()) {
|
||||
val formula = first + sign + second
|
||||
setFormula(formula)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun addDigit(number: Int) {
|
||||
val currentValue = displayedNumber
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">الحاسبة</string>
|
||||
<string name="scientific_calculator">Scientific Calculator</string>
|
||||
|
||||
<!-- Calculator field -->
|
||||
<string name="formula_divide_by_zero_error">خطأ: القسمة على صفر</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="vibrate_on_button_press">الاهتزاز عند الضغط على الازرار</string>
|
||||
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">Kalkulyator</string>
|
||||
<string name="scientific_calculator">Scientific Calculator</string>
|
||||
|
||||
<!-- Calculator field -->
|
||||
<string name="formula_divide_by_zero_error">Səhv: sıfıra bölünmə</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="vibrate_on_button_press">Düyməyə basdıqda titrə</string>
|
||||
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">Kalkulačka</string>
|
||||
<string name="scientific_calculator">Vědecká kalkulačka</string>
|
||||
|
||||
<!-- Calculator field -->
|
||||
<string name="formula_divide_by_zero_error">Chyba: dělení nulou</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="vibrate_on_button_press">Vibrovat při stisku tlačítka</string>
|
||||
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">Cyfrifiannell</string>
|
||||
<string name="scientific_calculator">Cyfrifiannell Gwyddonol</string>
|
||||
|
||||
<!-- Calculator field -->
|
||||
<string name="formula_divide_by_zero_error">Gwall: rhannu â sero</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="vibrate_on_button_press">Dirgrynu wrth wasgu botymau</string>
|
||||
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">Rechner</string>ng>
|
||||
<string name="scientific_calculator">Wissenschaftlicher Rechner</string>
|
||||
|
||||
<!-- Calculator field -->
|
||||
<string name="formula_divide_by_zero_error">Fehler: Division durch Null</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="vibrate_on_button_press">Bei Tastendruck vibrieren</string>
|
||||
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">Αριθμομηχανή</string>
|
||||
<string name="scientific_calculator">Επιστημονική Αριθμομηχανή</string>
|
||||
|
||||
<!-- Calculator field -->
|
||||
<string name="formula_divide_by_zero_error">Σφάλμα: διαίρεση με μηδέν</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="vibrate_on_button_press">Δόνηση στο πάτημα πλήκτρου</string>
|
||||
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">Calculadora</string>
|
||||
<string name="scientific_calculator">Calculadora Científica</string>
|
||||
|
||||
<!-- Calculator field -->
|
||||
<string name="formula_divide_by_zero_error">Error: división por cero</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="vibrate_on_button_press">Vibrar al presionar un botón</string>
|
||||
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">Calculatrice</string>
|
||||
<string name="scientific_calculator">Scientific Calculator</string>
|
||||
|
||||
<!-- Calculator field -->
|
||||
<string name="formula_divide_by_zero_error">Erreur: division par zéro</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="vibrate_on_button_press">Vibrer lors de l\'appui sur les boutons</string>
|
||||
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">Kalkulator</string>
|
||||
<string name="scientific_calculator">Znanstveni kalkulator</string>
|
||||
|
||||
<!-- Calculator field -->
|
||||
<string name="formula_divide_by_zero_error">Pogreška: podjela prema nuli</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="vibrate_on_button_press">Vibriraj prilikom pritiska na gumb</string>
|
||||
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">Kalkulator</string>
|
||||
<string name="scientific_calculator">Kalkulator Sains</string>
|
||||
|
||||
<!-- Calculator field -->
|
||||
<string name="formula_divide_by_zero_error">Kesalahan: pembagian dengan nol</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="vibrate_on_button_press">Getar saat tombol ditekan</string>
|
||||
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">Kalkulator</string>
|
||||
<string name="scientific_calculator">Kalkulator Sains</string>
|
||||
|
||||
<!-- Calculator field -->
|
||||
<string name="formula_divide_by_zero_error">Kesalahan: pembagian dengan nol</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="vibrate_on_button_press">Getar saat tombol ditekan</string>
|
||||
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">Calcolatrice</string>
|
||||
<string name="scientific_calculator">Calcolatrice scientifica</string>
|
||||
|
||||
<!-- Calculator field -->
|
||||
<string name="formula_divide_by_zero_error">Errore: divisione per zero</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="vibrate_on_button_press">Vibra alla pressione di un tasto</string>
|
||||
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">電卓</string>
|
||||
<string name="scientific_calculator">Scientific Calculator</string>
|
||||
|
||||
<!-- Calculator field -->
|
||||
<string name="formula_divide_by_zero_error">エラー:ゼロによる除算</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="vibrate_on_button_press">ボタンのタップ時に振動する</string>
|
||||
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">Skaičiuotuvas</string>
|
||||
<string name="scientific_calculator">Scientific Calculator</string>
|
||||
|
||||
<!-- Calculator field -->
|
||||
<string name="formula_divide_by_zero_error">Klaida: padalijimas iš nulio</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="vibrate_on_button_press">Vibruoti kai spaudžiami mygtukai</string>
|
||||
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">Rekenmachine</string>
|
||||
<string name="scientific_calculator">Wetenschappelijke Rekenmachine</string>
|
||||
|
||||
<!-- Calculator field -->
|
||||
<string name="formula_divide_by_zero_error">Fout: delen door nul</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="vibrate_on_button_press">Trillen bij toetsaanslagen</string>
|
||||
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">Kalkulator</string>
|
||||
<string name="scientific_calculator">Scientific Calculator</string>
|
||||
|
||||
<!-- Calculator field -->
|
||||
<string name="formula_divide_by_zero_error">Błąd: dzielenie przez zero</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="vibrate_on_button_press">Wibracja po wciśnięciu przycisku</string>
|
||||
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">Calculadora</string>
|
||||
<string name="scientific_calculator">Calculadora científica</string>
|
||||
|
||||
<!-- Calculator field -->
|
||||
<string name="formula_divide_by_zero_error">Erro: divisão por zero</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="vibrate_on_button_press">Vibrar ao tocar nos botões</string>
|
||||
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">Калькулятор</string>
|
||||
<string name="scientific_calculator">Научный калькулятор</string>
|
||||
|
||||
<!-- Calculator field -->
|
||||
<string name="formula_divide_by_zero_error">Ошибка: деление на ноль</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="vibrate_on_button_press">Вибрация при нажатии кнопок</string>
|
||||
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">Kalkulačka</string>
|
||||
<string name="scientific_calculator">Vedecká kalkulačka</string>
|
||||
|
||||
<!-- Calculator field -->
|
||||
<string name="formula_divide_by_zero_error">Chyba: delenie nulou</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="vibrate_on_button_press">Vibrovať pri stlačení tlačidla</string>
|
||||
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">Kalkylator</string>
|
||||
<string name="scientific_calculator">Avancerad kalkylator</string>
|
||||
|
||||
<!-- Calculator field -->
|
||||
<string name="formula_divide_by_zero_error">Fel: delning med noll</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="vibrate_on_button_press">Vibrera när jag trycker på knapparna</string>
|
||||
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">Hesap Makinesi</string>
|
||||
<string name="scientific_calculator">Bilimsel Hesap Makinesi</string>
|
||||
|
||||
<!-- Calculator field -->
|
||||
<string name="formula_divide_by_zero_error">Hata: sıfıra bölme</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="vibrate_on_button_press">Düğmeye basıldığında titret</string>
|
||||
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">Калькулятор</string>
|
||||
<string name="scientific_calculator">Науковий Калькулятор</string>
|
||||
|
||||
<!-- Calculator field -->
|
||||
<string name="formula_divide_by_zero_error">Помилка: ділення на нуль</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="vibrate_on_button_press">Вібрувати з натиском кнопок</string>
|
||||
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">簡易計算機</string>
|
||||
<string name="scientific_calculator">工程計算機</string>
|
||||
|
||||
<!-- Calculator field -->
|
||||
<string name="formula_divide_by_zero_error">錯誤:被零除</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="vibrate_on_button_press">按下按鈕時震動</string>
|
||||
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<string name="app_launcher_name">Calculator</string>
|
||||
<string name="scientific_calculator">Scientific Calculator</string>
|
||||
|
||||
<!-- Calculator field -->
|
||||
<string name="formula_divide_by_zero_error">Error: division by zero</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="vibrate_on_button_press">Vibrate on button press</string>
|
||||
|
||||
|
|
Loading…
Reference in New Issue