From f022815e99b406f4450823c4fe5f8f20a0e3042d Mon Sep 17 00:00:00 2001 From: Nishith Khanna Date: Fri, 9 Sep 2022 14:16:01 +0530 Subject: [PATCH 1/4] Change app icon to our custom icon --- res/drawable/ic_launcher_background.xml | 66 +++++++-------- res/drawable/ic_launcher_foreground.xml | 106 +++++++++++++----------- res/drawable/ic_launcher_monochrome.xml | 15 ---- res/mipmap-anydpi/ic_launcher.xml | 24 ++++-- 4 files changed, 104 insertions(+), 107 deletions(-) delete mode 100644 res/drawable/ic_launcher_monochrome.xml diff --git a/res/drawable/ic_launcher_background.xml b/res/drawable/ic_launcher_background.xml index 4b7005db..b16b69a1 100644 --- a/res/drawable/ic_launcher_background.xml +++ b/res/drawable/ic_launcher_background.xml @@ -1,47 +1,37 @@ + ~ Copyright ECORP SAS 2022 + ~ This program is free software: you can redistribute it and/or modify + ~ it under the terms of the GNU General Public License as published by + ~ the Free Software Foundation, either version 3 of the License, or + ~ (at your option) any later version. + ~ + ~ This program is distributed in the hope that it will be useful, + ~ but WITHOUT ANY WARRANTY; without even the implied warranty of + ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ~ GNU General Public License for more details. + ~ + ~ You should have received a copy of the GNU General Public License + ~ along with this program. If not, see . + --> - - - - - - - - - - - + android:pathData="M0,0h108v108h-108z"> + + + + + + + diff --git a/res/drawable/ic_launcher_foreground.xml b/res/drawable/ic_launcher_foreground.xml index e2f10e21..da55a6b1 100644 --- a/res/drawable/ic_launcher_foreground.xml +++ b/res/drawable/ic_launcher_foreground.xml @@ -1,57 +1,67 @@ + ~ Copyright ECORP SAS 2022 + ~ This program is free software: you can redistribute it and/or modify + ~ it under the terms of the GNU General Public License as published by + ~ the Free Software Foundation, either version 3 of the License, or + ~ (at your option) any later version. + ~ + ~ This program is distributed in the hope that it will be useful, + ~ but WITHOUT ANY WARRANTY; without even the implied warranty of + ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ~ GNU General Public License for more details. + ~ + ~ You should have received a copy of the GNU General Public License + ~ along with this program. If not, see . + --> - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/res/drawable/ic_launcher_monochrome.xml b/res/drawable/ic_launcher_monochrome.xml deleted file mode 100644 index e8f78b92..00000000 --- a/res/drawable/ic_launcher_monochrome.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - diff --git a/res/mipmap-anydpi/ic_launcher.xml b/res/mipmap-anydpi/ic_launcher.xml index b58c81ff..463b2ba9 100644 --- a/res/mipmap-anydpi/ic_launcher.xml +++ b/res/mipmap-anydpi/ic_launcher.xml @@ -1,10 +1,22 @@ + ~ Copyright ECORP SAS 2022 + ~ This program is free software: you can redistribute it and/or modify + ~ it under the terms of the GNU General Public License as published by + ~ the Free Software Foundation, either version 3 of the License, or + ~ (at your option) any later version. + ~ + ~ This program is distributed in the hope that it will be useful, + ~ but WITHOUT ANY WARRANTY; without even the implied warranty of + ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ~ GNU General Public License for more details. + ~ + ~ You should have received a copy of the GNU General Public License + ~ along with this program. If not, see . + --> - - - + + + + -- GitLab From 6c76653236512d7d2be0f07dc11740b504d9a4fe Mon Sep 17 00:00:00 2001 From: Nishith Khanna Date: Mon, 10 Oct 2022 15:26:51 +0530 Subject: [PATCH 2/4] Theme app according to our palette --- Android.bp | 2 + assets/licenses.html | 2 +- res/drawable/ic_advanced_bar.xml | 25 ++ res/drawable/ic_del.xml | 2 +- res/layout-land/pad_advanced_3x5.xml | 208 ++++++++++ res/layout/activity_calculator_land.xml | 5 + res/layout/activity_calculator_port.xml | 5 + .../activity_calculator_tablet_port.xml | 5 + res/layout/fragment_history.xml | 1 - res/layout/history_item.xml | 2 +- res/layout/pad_advanced_3x5.xml | 392 +++++++++--------- res/values-night/lineage_colors.xml | 42 -- res/values-night/lineage_styles.xml | 3 + res/values/color.xml | 33 +- res/values/lineage_colors.xml | 4 +- res/values/themes.xml | 9 +- src/com/android/calculator2/Calculator.java | 1 - src/com/android/calculator2/Licenses.java | 17 + 18 files changed, 501 insertions(+), 257 deletions(-) create mode 100644 res/drawable/ic_advanced_bar.xml create mode 100644 res/layout-land/pad_advanced_3x5.xml delete mode 100644 res/values-night/lineage_colors.xml diff --git a/Android.bp b/Android.bp index 0b867ed5..8f7f7705 100644 --- a/Android.bp +++ b/Android.bp @@ -36,5 +36,7 @@ android_app { "androidx.legacy_legacy-support-v4", "androidx.gridlayout_gridlayout", "androidx.recyclerview_recyclerview", + "androidx.webkit_webkit", + "elib", ], } diff --git a/assets/licenses.html b/assets/licenses.html index 4583bf74..480c3246 100644 --- a/assets/licenses.html +++ b/assets/licenses.html @@ -1,7 +1,7 @@ - +

Notices for files:

diff --git a/res/drawable/ic_advanced_bar.xml b/res/drawable/ic_advanced_bar.xml new file mode 100644 index 00000000..89623f80 --- /dev/null +++ b/res/drawable/ic_advanced_bar.xml @@ -0,0 +1,25 @@ + + + + + diff --git a/res/drawable/ic_del.xml b/res/drawable/ic_del.xml index f26eac24..14691140 100644 --- a/res/drawable/ic_del.xml +++ b/res/drawable/ic_del.xml @@ -21,7 +21,7 @@ android:viewportHeight="24" android:viewportWidth="24"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/layout/activity_calculator_land.xml b/res/layout/activity_calculator_land.xml index a19cd861..5a487e32 100644 --- a/res/layout/activity_calculator_land.xml +++ b/res/layout/activity_calculator_land.xml @@ -26,6 +26,11 @@ android:layout_width="match_parent" android:layout_height="wrap_content" /> + + + + + + diff --git a/res/layout/history_item.xml b/res/layout/history_item.xml index cf8b6c06..4b319df8 100644 --- a/res/layout/history_item.xml +++ b/res/layout/history_item.xml @@ -42,7 +42,7 @@ android:paddingStart="@dimen/result_padding_start" android:paddingEnd="@dimen/result_padding_end" android:text="@string/title_current_expression" - android:textColor="?android:attr/colorAccent" + android:textColor="?android:attr/textColorPrimary" android:textSize="14dp" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:orientation="horizontal" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:background="@color/pad_advanced_background_color" > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/res/values-night/lineage_colors.xml b/res/values-night/lineage_colors.xml deleted file mode 100644 index bfda51b6..00000000 --- a/res/values-night/lineage_colors.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - #212121 - - - #000000 - - - #1E1E1E - - - @android:color/white - - - #6CFFFFFF - - - #40FFFFFF - - - @android:color/white - - - #33FFFFFF - diff --git a/res/values-night/lineage_styles.xml b/res/values-night/lineage_styles.xml index 9d9eb6b9..90016c79 100644 --- a/res/values-night/lineage_styles.xml +++ b/res/values-night/lineage_styles.xml @@ -20,7 +20,10 @@ @color/calculator_primary_color @color/calculator_accent_color @color/calculator_statusbar_color + @color/navigationBar_color stateAlwaysHidden + false + false - + + diff --git a/src/com/android/calculator2/Calculator.java b/src/com/android/calculator2/Calculator.java index 81ab1f65..d765e055 100644 --- a/src/com/android/calculator2/Calculator.java +++ b/src/com/android/calculator2/Calculator.java @@ -520,7 +520,6 @@ public class Calculator extends Activity ContextCompat.getColor(this, R.color.calculator_error_color); mFormulaText.setTextColor(errorColor); mResultText.setTextColor(errorColor); - getWindow().setStatusBarColor(errorColor); } else if (mCurrentState != CalculatorState.RESULT) { mFormulaText.setTextColor( ContextCompat.getColor(this, R.color.display_formula_text_color)); diff --git a/src/com/android/calculator2/Licenses.java b/src/com/android/calculator2/Licenses.java index 4af1ea6d..81bf117e 100644 --- a/src/com/android/calculator2/Licenses.java +++ b/src/com/android/calculator2/Licenses.java @@ -4,6 +4,10 @@ import android.app.Activity; import android.os.Bundle; import android.view.MenuItem; import android.webkit.WebView; +import android.content.res.Configuration; +import androidx.webkit.WebViewFeature; +import androidx.webkit.WebSettingsCompat; + public class Licenses extends Activity { @@ -17,6 +21,19 @@ public class Licenses extends Activity { webView.loadUrl(LICENSE_URL); setContentView(webView); + + if (WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK)) { + switch (getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) { + case Configuration.UI_MODE_NIGHT_YES: + WebSettingsCompat.setForceDark(webView.getSettings(), WebSettingsCompat.FORCE_DARK_ON); + break; + case Configuration.UI_MODE_NIGHT_NO: + case Configuration.UI_MODE_NIGHT_UNDEFINED: + WebSettingsCompat.setForceDark(webView.getSettings(), WebSettingsCompat.FORCE_DARK_OFF); + break; + } +} + } @Override -- GitLab From 23a11219f0052c390b301206b9b17768c0694f4d Mon Sep 17 00:00:00 2001 From: Nishith Khanna Date: Tue, 14 Mar 2023 19:04:08 +0530 Subject: [PATCH 3/4] Improve ui of calculator and fix issue in high dpi screens --- res/drawable/ic_del.xml | 19 +- res/layout-land/pad_advanced_3x5.xml | 66 ++---- res/layout/activity_calculator_land.xml | 3 +- res/layout/activity_calculator_port.xml | 3 +- .../activity_calculator_tablet_port.xml | 3 +- res/layout/pad_advanced_3x5.xml | 66 ++---- res/layout/pad_main.xml | 191 ++++++++++++++++++ res/layout/pad_numeric.xml | 112 ---------- res/values-w230dp-h275dp/layout.xml | 3 +- res/values-w230dp-h375dp/layout.xml | 3 +- res/values-w230dp-h475dp-port/layout.xml | 1 - res/values-w375dp-h220dp/layout.xml | 3 +- res/values-w375dp-h275dp/layout.xml | 3 +- res/values-w375dp-h375dp/layout.xml | 3 +- res/values-w375dp-h500dp-port/layout.xml | 1 - res/values-w375dp-h768dp-port/layout.xml | 5 +- res/values-w375dp-h768dp-port/styles.xml | 3 +- res/values-w520dp-h220dp-land/layout.xml | 3 +- res/values-w520dp-h275dp-land/layout.xml | 1 - res/values-w520dp-h375dp-land/layout.xml | 1 - res/values-w520dp-h500dp-land/layout.xml | 1 - res/values-w520dp-h768dp-land/layout.xml | 1 - res/values-w520dp-h768dp-port/layout.xml | 5 +- res/values-w520dp-h768dp-port/styles.xml | 3 +- res/values/layout.xml | 3 +- res/values/styles.xml | 15 ++ 26 files changed, 272 insertions(+), 249 deletions(-) create mode 100644 res/layout/pad_main.xml delete mode 100644 res/layout/pad_numeric.xml diff --git a/res/drawable/ic_del.xml b/res/drawable/ic_del.xml index 14691140..716c62ea 100644 --- a/res/drawable/ic_del.xml +++ b/res/drawable/ic_del.xml @@ -14,16 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. --> - - + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + + diff --git a/res/layout-land/pad_advanced_3x5.xml b/res/layout-land/pad_advanced_3x5.xml index dfd283d5..c17548b0 100644 --- a/res/layout-land/pad_advanced_3x5.xml +++ b/res/layout-land/pad_advanced_3x5.xml @@ -21,12 +21,12 @@ android:id="@+id/pad_advanced" style="@style/PadLayoutStyle.Advanced" android:background="@color/pad_advanced_background_color" - app:rowCount="5" + app:rowCount="4" app:columnCount="3"> - - - - - - diff --git a/res/layout/activity_calculator_land.xml b/res/layout/activity_calculator_land.xml index 5a487e32..8fc54ed0 100644 --- a/res/layout/activity_calculator_land.xml +++ b/res/layout/activity_calculator_land.xml @@ -36,8 +36,7 @@ android:layout_height="0dip" android:layout_weight="1"> - - + diff --git a/res/layout/activity_calculator_port.xml b/res/layout/activity_calculator_port.xml index fb62c53b..f935b964 100644 --- a/res/layout/activity_calculator_port.xml +++ b/res/layout/activity_calculator_port.xml @@ -39,8 +39,7 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - - + diff --git a/res/layout/activity_calculator_tablet_port.xml b/res/layout/activity_calculator_tablet_port.xml index a5cd80e6..57e93063 100644 --- a/res/layout/activity_calculator_tablet_port.xml +++ b/res/layout/activity_calculator_tablet_port.xml @@ -35,8 +35,7 @@ android:layout_height="0dip" android:layout_weight="500"> - - + diff --git a/res/layout/pad_advanced_3x5.xml b/res/layout/pad_advanced_3x5.xml index 4bdef5ff..c37057ee 100644 --- a/res/layout/pad_advanced_3x5.xml +++ b/res/layout/pad_advanced_3x5.xml @@ -32,12 +32,12 @@ - - - - - - diff --git a/res/layout/pad_main.xml b/res/layout/pad_main.xml new file mode 100644 index 00000000..14801e59 --- /dev/null +++ b/res/layout/pad_main.xml @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/layout/pad_numeric.xml b/res/layout/pad_numeric.xml deleted file mode 100644 index cfe308b1..00000000 --- a/res/layout/pad_numeric.xml +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/res/values-w230dp-h275dp/layout.xml b/res/values-w230dp-h275dp/layout.xml index f9a2d970..07752d7d 100644 --- a/res/values-w230dp-h275dp/layout.xml +++ b/res/values-w230dp-h275dp/layout.xml @@ -18,6 +18,5 @@ @layout/activity_calculator_port @layout/display_two_line - @layout/pad_operator_one_col - @layout/pad_advanced_4x4 + @layout/pad_advanced_3x5 diff --git a/res/values-w230dp-h375dp/layout.xml b/res/values-w230dp-h375dp/layout.xml index f9a2d970..07752d7d 100644 --- a/res/values-w230dp-h375dp/layout.xml +++ b/res/values-w230dp-h375dp/layout.xml @@ -18,6 +18,5 @@ @layout/activity_calculator_port @layout/display_two_line - @layout/pad_operator_one_col - @layout/pad_advanced_4x4 + @layout/pad_advanced_3x5 diff --git a/res/values-w230dp-h475dp-port/layout.xml b/res/values-w230dp-h475dp-port/layout.xml index 9f7bd6bb..07752d7d 100644 --- a/res/values-w230dp-h475dp-port/layout.xml +++ b/res/values-w230dp-h475dp-port/layout.xml @@ -18,6 +18,5 @@ @layout/activity_calculator_port @layout/display_two_line - @layout/pad_operator_one_col @layout/pad_advanced_3x5 diff --git a/res/values-w375dp-h220dp/layout.xml b/res/values-w375dp-h220dp/layout.xml index ac4cde83..611e2fa2 100644 --- a/res/values-w375dp-h220dp/layout.xml +++ b/res/values-w375dp-h220dp/layout.xml @@ -18,6 +18,5 @@ @layout/activity_calculator_port @layout/display_one_line - @layout/pad_operator_two_col - @layout/pad_advanced_4x4 + @layout/pad_advanced_3x5 diff --git a/res/values-w375dp-h275dp/layout.xml b/res/values-w375dp-h275dp/layout.xml index 3890667a..07752d7d 100644 --- a/res/values-w375dp-h275dp/layout.xml +++ b/res/values-w375dp-h275dp/layout.xml @@ -18,6 +18,5 @@ @layout/activity_calculator_port @layout/display_two_line - @layout/pad_operator_two_col - @layout/pad_advanced_4x4 + @layout/pad_advanced_3x5 diff --git a/res/values-w375dp-h375dp/layout.xml b/res/values-w375dp-h375dp/layout.xml index 3890667a..07752d7d 100644 --- a/res/values-w375dp-h375dp/layout.xml +++ b/res/values-w375dp-h375dp/layout.xml @@ -18,6 +18,5 @@ @layout/activity_calculator_port @layout/display_two_line - @layout/pad_operator_two_col - @layout/pad_advanced_4x4 + @layout/pad_advanced_3x5 diff --git a/res/values-w375dp-h500dp-port/layout.xml b/res/values-w375dp-h500dp-port/layout.xml index 9f7bd6bb..07752d7d 100644 --- a/res/values-w375dp-h500dp-port/layout.xml +++ b/res/values-w375dp-h500dp-port/layout.xml @@ -18,6 +18,5 @@ @layout/activity_calculator_port @layout/display_two_line - @layout/pad_operator_one_col @layout/pad_advanced_3x5 diff --git a/res/values-w375dp-h768dp-port/layout.xml b/res/values-w375dp-h768dp-port/layout.xml index 98db0fee..07752d7d 100644 --- a/res/values-w375dp-h768dp-port/layout.xml +++ b/res/values-w375dp-h768dp-port/layout.xml @@ -16,8 +16,7 @@ --> - @layout/activity_calculator_tablet_port + @layout/activity_calculator_port @layout/display_two_line - @layout/pad_advanced_5x3 - @layout/pad_operator_two_col + @layout/pad_advanced_3x5 diff --git a/res/values-w375dp-h768dp-port/styles.xml b/res/values-w375dp-h768dp-port/styles.xml index 2c5ae357..b8caea0b 100644 --- a/res/values-w375dp-h768dp-port/styles.xml +++ b/res/values-w375dp-h768dp-port/styles.xml @@ -46,8 +46,7 @@ + + + + + + -- GitLab From 50325e19ff027884f459c6b430fe9fa7792fa7f1 Mon Sep 17 00:00:00 2001 From: Nishith Khanna Date: Wed, 22 Mar 2023 17:28:39 +0530 Subject: [PATCH 4/4] Port translation changes from Android S --- res/values-fr/strings.xml | 137 +++++++++++++++++++------------------- res/values-nl/strings.xml | 13 ++-- 2 files changed, 72 insertions(+), 78 deletions(-) diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml index 8e0bea48..b777f04f 100644 --- a/res/values-fr/strings.xml +++ b/res/values-fr/strings.xml @@ -1,4 +1,4 @@ - + - - - "Calculatrice" - "," - "deg" - "rad" - "effacés" - "sup" - "nombre d\'Euler" - "pi" - "virgule" - "parenthèse gauche" - "parenthèse droite" - "cosinus" - "logarithme naturel" - "logarithme" - "sinus" - "tangente" - "cosinus inverse" - "sinus inverse" - "tangente inverse" - "dix à la puissance" - "fonction exponentielle" - "au carré" - "plus" - "divisé" - "factoriel" - "multiplier" - "pourcent" - "puissance" - "racine carrée" - "moins" - "mode degrés" - "mode radians" - "passer en mode degrés" - "passer en mode radians" - "égal" - "effacer" - "supprimer" - "afficher les fonctions inverses" - "masquer les fonctions inverses" - "Aucune formule" - "Aucun résultat" - "Nombres et opérations de base" - "Opérations avancées" - "Pas un nombre" - "Express. incorr." + --> + Calculatrice + , + deg + rad + effacé + suppr + nombre d\'Euler + pi + virgule + parenthèse gauche + parenthèse droite + cosinus + logarithme naturel + logarithme + sinus + tangente + cosinus inverse + sinus inverse + tangente inverse + dix à la puissance + fonction exponentielle + au carré + plus + diviser + factoriel + multiplier + pour cent + puissance + racine carrée + moins + mode degré + mode radian + passer en mode degré + passer en mode radian + égale + effacer + supprimer + afficher les fonctions inverses + masquer les fonctions inverses + Aucune formule + Aucun résultat + Nombres et opérations de base + Opérations avancées + Pas un nombre + Express. incorr. "Annulée" - "Infini ?" - "Div par 0 impossible" - "Le texte a bien été copié." - "Calcul annulé." - "Il est possible que la valeur soit infinie ou non définie." - "Utiliser délais plus longs" - "Fermer" - "(exact)" - "(±1 au dernier chiffre)" - "Réponse avec prem. chiffres" + Infini \? + Div par 0 impossible + Texte copié + Calcul annulé. + Il est possible que la valeur soit infinie ou non définie. + Utiliser des délais plus longs + Ignorer + (exact) + (±1 sur dernier chiffre) + Réponse avec prem. chiffres "Réponse en fraction" - "Licences Open Source" - "Historique" - "Effacer" - "Historique" - "Remonter d\'un niveau" - "Expiration du délai" - "Effacer historique et mémoire ?" - "Expression actuelle" - "Aucun historique" - + Licences Open Source + Historique + Effacer + Historique + Remonter d\'un niveau + Expiration du délai + Effacer l\'historique et la mémoire \? + Expression actuelle + Aucun historique + \ No newline at end of file diff --git a/res/values-nl/strings.xml b/res/values-nl/strings.xml index 64241ad2..555742e8 100644 --- a/res/values-nl/strings.xml +++ b/res/values-nl/strings.xml @@ -1,4 +1,4 @@ - + - - + --> "Rekenmachine" "," "deg" - "rad" + rad "gewist" "←" "constante van Neper" @@ -70,7 +67,7 @@ "De waarde is mogelijk oneindig of niet gedefinieerd." "Langere time-outs gebruiken" "Sluiten" - "(exact)" + (exact) "(±1 in laatste cijfer)" "Antwoord met voorloopcijfers" "Antwoord als breuk" @@ -83,4 +80,4 @@ "Geschiedenis/geheugen wissen?" "Huidige expressie" "Geen geschiedenis" - + \ No newline at end of file -- GitLab