From 005c208ed28b8d8655630cdd26c3cf70171b6eb3 Mon Sep 17 00:00:00 2001 From: Albin Date: Tue, 11 Jun 2024 23:44:19 +0200 Subject: [PATCH 1/2] Fix outdated tidy script paths --- android/scripts/tidy.sh | 54 +++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/android/scripts/tidy.sh b/android/scripts/tidy.sh index 173d42d90595..85d5630f6443 100755 --- a/android/scripts/tidy.sh +++ b/android/scripts/tidy.sh @@ -24,37 +24,43 @@ function main { # Autoformats Android XML files function format { - tidy -xml \ - -m \ - -i \ - -w 100 \ - -utf8 \ - --quiet yes \ - --indent-attributes yes \ - --indent-spaces 4 \ - --literal-attributes yes \ - ../**/src/*/AndroidManifest.xml \ - ../lib/resource/src/main/res/anim*/*.xml \ - ../lib/resource/src/main/res/drawable*/*.xml \ - ../app/src/main/res/layout*/*.xml + non_text_xml_paths=("$(find .. -wholename "*/src/*.xml" ! -name "strings*.xml" ! -name plurals.xml)") + for xml_path in "${non_text_xml_paths[@]}"; do + tidy -xml \ + -m \ + -i \ + -w 100 \ + -utf8 \ + --quiet yes \ + --indent-attributes yes \ + --indent-spaces 4 \ + --literal-attributes yes \ + "$xml_path" + done - tidy -xml \ - -m \ - -i \ - -w 0 \ - -utf8 \ - --quiet yes \ - --indent-spaces 4 \ - --literal-attributes yes \ - --indent-cdata yes \ - ../lib/resource/src/main/res/values/*.xml + # We only format non-translated files since we don't want + # to introduce a mismatch between the xml files and source + # (.po) files. + non_translated_text_xml_paths=("$(find .. -wholename "*/values/strings*.xml" -o -wholename "*/values/plurals.xml")") + for xml_path in "${non_translated_text_xml_paths[@]}"; do + tidy -xml \ + -m \ + -i \ + -w 0 \ + -utf8 \ + --quiet yes \ + --indent-spaces 4 \ + --literal-attributes yes \ + --indent-cdata yes \ + "$xml_path" + done # FIXME - when tidy learns to not leave whitespace around, remove the line below - https://github.com/htacg/tidy-html5/issues/864 find .. -name '*.xml' -exec sed -i -e 's/[ \t]*$//' '{}' ';' } function checkDiff { - if git diff --exit-code -- ../**/AndroidManifest.xml ../**/src/main/res; then + if git diff --exit-code -- ../**/*.xml; then echo "Android XML files are correctly formatted" return 0 else From 596b605d5b02942cb94f0ca90be39a74c1a876f1 Mon Sep 17 00:00:00 2001 From: Albin Date: Tue, 11 Jun 2024 23:46:02 +0200 Subject: [PATCH 2/2] Format xml files --- .../app/src/main/res/xml/provider_paths.xml | 7 ++----- .../lib/common/src/main/AndroidManifest.xml | 2 +- .../src/main/res/drawable/ic_remove.xml | 13 ++++++------ .../src/main/res/drawable/icon_add.xml | 13 ++++++------ .../src/main/res/drawable/icon_delete.xml | 13 ++++++------ .../src/main/res/drawable/icon_edit.xml | 13 ++++++------ .../src/main/res/drawable/icon_fail.xml | 18 +++++++--------- .../src/main/res/drawable/icon_more_vert.xml | 13 ++++++------ .../src/main/res/drawable/icon_success.xml | 18 +++++++--------- .../main/res/drawable/icon_text_fields.xml | 13 ++++++------ .../main/res/drawable/icon_upload_file.xml | 13 ++++++------ .../main/res/drawable/icons_more_circle.xml | 21 +++++++++---------- .../res/mipmap-anydpi-v26/ic_launcher.xml | 6 +++--- .../resource/src/main/res/values/strings.xml | 1 - .../resource/src/main/res/values/styles.xml | 3 ++- android/test/e2e/src/main/AndroidManifest.xml | 16 +++++++------- .../test/mockapi/src/main/AndroidManifest.xml | 6 ++---- 17 files changed, 85 insertions(+), 104 deletions(-) diff --git a/android/app/src/main/res/xml/provider_paths.xml b/android/app/src/main/res/xml/provider_paths.xml index 921d92f8dd0c..7158cf665dc7 100644 --- a/android/app/src/main/res/xml/provider_paths.xml +++ b/android/app/src/main/res/xml/provider_paths.xml @@ -1,8 +1,5 @@ - + - - diff --git a/android/lib/common/src/main/AndroidManifest.xml b/android/lib/common/src/main/AndroidManifest.xml index d2bb18d6f33b..acaad2f3b4fc 100644 --- a/android/lib/common/src/main/AndroidManifest.xml +++ b/android/lib/common/src/main/AndroidManifest.xml @@ -1,4 +1,4 @@ + xmlns:tools="http://schemas.android.com/tools"> diff --git a/android/lib/resource/src/main/res/drawable/ic_remove.xml b/android/lib/resource/src/main/res/drawable/ic_remove.xml index 93b0990d6b6c..2a67ab07926b 100644 --- a/android/lib/resource/src/main/res/drawable/ic_remove.xml +++ b/android/lib/resource/src/main/res/drawable/ic_remove.xml @@ -1,9 +1,8 @@ - + android:width="24dp" + android:height="24dp" + android:viewportWidth="960" + android:viewportHeight="960"> + diff --git a/android/lib/resource/src/main/res/drawable/icon_add.xml b/android/lib/resource/src/main/res/drawable/icon_add.xml index 1b016dcfb2f2..bef890413b99 100644 --- a/android/lib/resource/src/main/res/drawable/icon_add.xml +++ b/android/lib/resource/src/main/res/drawable/icon_add.xml @@ -1,9 +1,8 @@ - + android:width="24dp" + android:height="24dp" + android:viewportWidth="960" + android:viewportHeight="960"> + diff --git a/android/lib/resource/src/main/res/drawable/icon_delete.xml b/android/lib/resource/src/main/res/drawable/icon_delete.xml index 0e8b2004cbe2..237623f73cfc 100644 --- a/android/lib/resource/src/main/res/drawable/icon_delete.xml +++ b/android/lib/resource/src/main/res/drawable/icon_delete.xml @@ -1,9 +1,8 @@ - + android:width="24dp" + android:height="24dp" + android:viewportWidth="960" + android:viewportHeight="960"> + diff --git a/android/lib/resource/src/main/res/drawable/icon_edit.xml b/android/lib/resource/src/main/res/drawable/icon_edit.xml index 3df2eb93a65f..aa7d748cc1d7 100644 --- a/android/lib/resource/src/main/res/drawable/icon_edit.xml +++ b/android/lib/resource/src/main/res/drawable/icon_edit.xml @@ -1,9 +1,8 @@ - + android:width="24dp" + android:height="24dp" + android:viewportWidth="960" + android:viewportHeight="960"> + diff --git a/android/lib/resource/src/main/res/drawable/icon_fail.xml b/android/lib/resource/src/main/res/drawable/icon_fail.xml index 1bb4906a3368..3f934a13003c 100644 --- a/android/lib/resource/src/main/res/drawable/icon_fail.xml +++ b/android/lib/resource/src/main/res/drawable/icon_fail.xml @@ -1,12 +1,10 @@ - - + android:width="44dp" + android:height="44dp" + android:viewportWidth="44" + android:viewportHeight="44"> + + diff --git a/android/lib/resource/src/main/res/drawable/icon_more_vert.xml b/android/lib/resource/src/main/res/drawable/icon_more_vert.xml index 59400ec9774b..b96d08bd906d 100644 --- a/android/lib/resource/src/main/res/drawable/icon_more_vert.xml +++ b/android/lib/resource/src/main/res/drawable/icon_more_vert.xml @@ -1,9 +1,8 @@ - + android:width="24dp" + android:height="24dp" + android:viewportWidth="960" + android:viewportHeight="960"> + diff --git a/android/lib/resource/src/main/res/drawable/icon_success.xml b/android/lib/resource/src/main/res/drawable/icon_success.xml index fc8627e9b6a0..1b15d4c1c4a0 100644 --- a/android/lib/resource/src/main/res/drawable/icon_success.xml +++ b/android/lib/resource/src/main/res/drawable/icon_success.xml @@ -1,13 +1,11 @@ - - + android:width="44dp" + android:height="44dp" + android:viewportWidth="44.0" + android:viewportHeight="44.0"> + + diff --git a/android/lib/resource/src/main/res/drawable/icon_text_fields.xml b/android/lib/resource/src/main/res/drawable/icon_text_fields.xml index ecc60729990e..c3b8ccbbfc40 100644 --- a/android/lib/resource/src/main/res/drawable/icon_text_fields.xml +++ b/android/lib/resource/src/main/res/drawable/icon_text_fields.xml @@ -1,9 +1,8 @@ - + android:width="24dp" + android:height="24dp" + android:viewportWidth="960" + android:viewportHeight="960"> + diff --git a/android/lib/resource/src/main/res/drawable/icon_upload_file.xml b/android/lib/resource/src/main/res/drawable/icon_upload_file.xml index 4f812f7fc580..29d87d78d2bb 100644 --- a/android/lib/resource/src/main/res/drawable/icon_upload_file.xml +++ b/android/lib/resource/src/main/res/drawable/icon_upload_file.xml @@ -1,9 +1,8 @@ - + android:width="24dp" + android:height="24dp" + android:viewportWidth="960" + android:viewportHeight="960"> + diff --git a/android/lib/resource/src/main/res/drawable/icons_more_circle.xml b/android/lib/resource/src/main/res/drawable/icons_more_circle.xml index 2f7800ccf377..605975ea3763 100644 --- a/android/lib/resource/src/main/res/drawable/icons_more_circle.xml +++ b/android/lib/resource/src/main/res/drawable/icons_more_circle.xml @@ -1,13 +1,12 @@ - + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + diff --git a/android/lib/resource/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/android/lib/resource/src/main/res/mipmap-anydpi-v26/ic_launcher.xml index 1e1d3c38b110..56eaaf98c2c5 100644 --- a/android/lib/resource/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ b/android/lib/resource/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -1,6 +1,6 @@ - - - + + + diff --git a/android/lib/resource/src/main/res/values/strings.xml b/android/lib/resource/src/main/res/values/strings.xml index d869653c312c..67d5707631b6 100644 --- a/android/lib/resource/src/main/res/values/strings.xml +++ b/android/lib/resource/src/main/res/values/strings.xml @@ -232,7 +232,6 @@ On (UDP-over-TCP) Automatic Off - UDP-over-TCP port Which TCP port the UDP-over-TCP obfuscation protocol should connect to on the VPN server. Created: %s diff --git a/android/lib/resource/src/main/res/values/styles.xml b/android/lib/resource/src/main/res/values/styles.xml index 5c94a24ebff8..fb477d0a713e 100644 --- a/android/lib/resource/src/main/res/values/styles.xml +++ b/android/lib/resource/src/main/res/values/styles.xml @@ -1,5 +1,6 @@ -