From f0b28742aca4e24392066d949090f53f3a88136d Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 15 Jun 2021 10:30:54 +0200 Subject: [PATCH] textSize *sp -> style --- tools/check/check_code_quality.sh | 16 +++++++- tools/check/forbidden_strings_in_layout.txt | 27 +++++++++++++ .../src/debug/res/layout/item_sas_emoji.xml | 2 +- vector/src/main/res/layout/activity_call.xml | 2 +- .../res/layout/bottom_sheet_bootstrap.xml | 5 ++- .../res/layout/bottom_sheet_call_dial_pad.xml | 4 +- .../bottom_sheet_room_widget_permission.xml | 2 +- .../layout/bottom_sheet_save_recovery_key.xml | 10 +++-- .../res/layout/bottom_sheet_verification.xml | 3 +- .../custom_action_item_layout_badge.xml | 6 +-- .../res/layout/dialog_disclaimer_content.xml | 2 +- .../main/res/layout/dialog_event_content.xml | 6 ++- .../layout/dialog_recovery_key_saved_info.xml | 2 +- .../main/res/layout/fragment_home_detail.xml | 4 +- .../fragment_keys_backup_restore_success.xml | 2 +- .../fragment_keys_backup_setup_step2.xml | 2 +- .../fragment_keys_backup_setup_step3.xml | 4 +- ...ment_space_create_choose_private_model.xml | 2 +- .../fragment_space_create_choose_type.xml | 2 +- .../layout/fragment_ssss_access_from_key.xml | 2 +- .../fragment_ssss_access_from_passphrase.xml | 2 +- .../res/layout/fragment_ssss_reset_all.xml | 4 +- .../src/main/res/layout/grid_item_emoji.xml | 9 +---- .../res/layout/item_autocomplete_emoji.xml | 2 +- .../res/layout/item_bottom_sheet_action.xml | 4 +- .../item_bottom_sheet_quick_reaction.xml | 39 +++++++------------ .../item_create_direct_room_letter_header.xml | 3 +- .../src/main/res/layout/item_emoji_result.xml | 3 +- .../src/main/res/layout/item_emoji_verif.xml | 1 + .../main/res/layout/item_profile_section.xml | 2 +- .../src/main/res/layout/item_public_room.xml | 2 +- .../src/main/res/layout/item_pushgateway.xml | 2 +- ...meline_event_merged_room_creation_stub.xml | 2 +- .../item_user_directory_letter_header.xml | 3 +- .../main/res/layout/item_user_list_header.xml | 3 +- .../layout/item_verification_decimal_code.xml | 6 +-- ...ew_sign_out_bottom_sheet_action_button.xml | 4 +- .../view_stub_room_member_profile_header.xml | 2 +- .../layout/view_stub_room_profile_header.xml | 2 +- 39 files changed, 113 insertions(+), 87 deletions(-) create mode 100644 tools/check/forbidden_strings_in_layout.txt diff --git a/tools/check/check_code_quality.sh b/tools/check/check_code_quality.sh index 0b4272cbfe..7decb985bb 100755 --- a/tools/check/check_code_quality.sh +++ b/tools/check/check_code_quality.sh @@ -95,6 +95,14 @@ ${searchForbiddenStringsScript} ./tools/check/forbidden_strings_in_resources.txt resultForbiddenStringInResource=$? +echo +echo "Search for forbidden patterns in layouts..." + +${searchForbiddenStringsScript} ./tools/check/forbidden_strings_in_layout.txt \ + ./vector/src/main/res/layout + +resultForbiddenStringInLayout=$? + ####################################################################################################################### # Check files with long lines ####################################################################################################################### @@ -156,7 +164,13 @@ fi echo -if [[ ${resultNbOfDrawable} -eq 0 ]] && [[ ${resultForbiddenStringInCode} -eq 0 ]] && [[ ${resultForbiddenStringInCodeSdk} -eq 0 ]] && [[ ${resultForbiddenStringInResource} -eq 0 ]] && [[ ${resultLongFiles} -eq 0 ]] && [[ ${resultPngInDrawable} -eq 0 ]]; then +if [[ ${resultNbOfDrawable} -eq 0 ]] \ + && [[ ${resultForbiddenStringInCode} -eq 0 ]] \ + && [[ ${resultForbiddenStringInCodeSdk} -eq 0 ]] \ + && [[ ${resultForbiddenStringInResource} -eq 0 ]] \ + && [[ ${resultForbiddenStringInLayout} -eq 0 ]] \ + && [[ ${resultLongFiles} -eq 0 ]] \ + && [[ ${resultPngInDrawable} -eq 0 ]]; then echo "MAIN OK" else echo "❌ MAIN ERROR" diff --git a/tools/check/forbidden_strings_in_layout.txt b/tools/check/forbidden_strings_in_layout.txt new file mode 100644 index 0000000000..dbbd7270d7 --- /dev/null +++ b/tools/check/forbidden_strings_in_layout.txt @@ -0,0 +1,27 @@ +# +# Copyright 2021 New Vector Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This file list String which are not allowed in source code. +# Use Perl regex to write forbidden strings +# Note: line cannot start with a space. Use \s instead. +# It is possible to specify an authorized number of occurrence with === suffix. Default is 0 +# Example: +# AuthorizedStringThreeTimes===3 + +# Extension:xml + +### Use style="@style/VectorTextView.*" instead of textSize attribute +android:textSize===9 diff --git a/vector/src/debug/res/layout/item_sas_emoji.xml b/vector/src/debug/res/layout/item_sas_emoji.xml index 94e0689b1f..ee2f068f1e 100644 --- a/vector/src/debug/res/layout/item_sas_emoji.xml +++ b/vector/src/debug/res/layout/item_sas_emoji.xml @@ -22,11 +22,11 @@ + android:textColor="?vctr_content_primary" /> + android:textColor="?vctr_content_primary" /> @@ -84,11 +85,12 @@ tools:ignore="MissingPrefix" /> + android:textColor="?vctr_content_primary" /> diff --git a/vector/src/main/res/layout/bottom_sheet_verification.xml b/vector/src/main/res/layout/bottom_sheet_verification.xml index f0591c608d..13316b2587 100644 --- a/vector/src/main/res/layout/bottom_sheet_verification.xml +++ b/vector/src/main/res/layout/bottom_sheet_verification.xml @@ -38,6 +38,7 @@ + tools:text="Event content" /> + \ No newline at end of file diff --git a/vector/src/main/res/layout/dialog_recovery_key_saved_info.xml b/vector/src/main/res/layout/dialog_recovery_key_saved_info.xml index 8bd855fc77..1243ab27bf 100644 --- a/vector/src/main/res/layout/dialog_recovery_key_saved_info.xml +++ b/vector/src/main/res/layout/dialog_recovery_key_saved_info.xml @@ -34,6 +34,7 @@ diff --git a/vector/src/main/res/layout/fragment_home_detail.xml b/vector/src/main/res/layout/fragment_home_detail.xml index ccdfbe698c..ad95f98fab 100644 --- a/vector/src/main/res/layout/fragment_home_detail.xml +++ b/vector/src/main/res/layout/fragment_home_detail.xml @@ -77,19 +77,19 @@ @@ -68,13 +68,13 @@ diff --git a/vector/src/main/res/layout/fragment_space_create_choose_private_model.xml b/vector/src/main/res/layout/fragment_space_create_choose_private_model.xml index 24b15ce737..d4f63aec93 100644 --- a/vector/src/main/res/layout/fragment_space_create_choose_private_model.xml +++ b/vector/src/main/res/layout/fragment_space_create_choose_private_model.xml @@ -13,12 +13,12 @@ diff --git a/vector/src/main/res/layout/fragment_space_create_choose_type.xml b/vector/src/main/res/layout/fragment_space_create_choose_type.xml index 2c28a35cf2..40a915d9e9 100644 --- a/vector/src/main/res/layout/fragment_space_create_choose_type.xml +++ b/vector/src/main/res/layout/fragment_space_create_choose_type.xml @@ -21,13 +21,13 @@ app:layout_constraintTop_toTopOf="parent" /> - - - - - - - - + diff --git a/vector/src/main/res/layout/item_autocomplete_emoji.xml b/vector/src/main/res/layout/item_autocomplete_emoji.xml index 8b4c78cdd9..62c435e6e5 100644 --- a/vector/src/main/res/layout/item_autocomplete_emoji.xml +++ b/vector/src/main/res/layout/item_autocomplete_emoji.xml @@ -10,11 +10,11 @@ diff --git a/vector/src/main/res/layout/item_bottom_sheet_action.xml b/vector/src/main/res/layout/item_bottom_sheet_action.xml index 348520b665..8f341f49a6 100644 --- a/vector/src/main/res/layout/item_bottom_sheet_action.xml +++ b/vector/src/main/res/layout/item_bottom_sheet_action.xml @@ -53,6 +53,7 @@ diff --git a/vector/src/main/res/layout/item_bottom_sheet_quick_reaction.xml b/vector/src/main/res/layout/item_bottom_sheet_quick_reaction.xml index 23494c9006..339813f736 100644 --- a/vector/src/main/res/layout/item_bottom_sheet_quick_reaction.xml +++ b/vector/src/main/res/layout/item_bottom_sheet_quick_reaction.xml @@ -9,83 +9,74 @@ - \ No newline at end of file diff --git a/vector/src/main/res/layout/item_emoji_result.xml b/vector/src/main/res/layout/item_emoji_result.xml index b520a8735a..6490cb9ed9 100644 --- a/vector/src/main/res/layout/item_emoji_result.xml +++ b/vector/src/main/res/layout/item_emoji_result.xml @@ -11,14 +11,13 @@ android:paddingStart="@dimen/layout_horizontal_margin" android:paddingEnd="@dimen/layout_horizontal_margin"> - diff --git a/vector/src/main/res/layout/item_emoji_verif.xml b/vector/src/main/res/layout/item_emoji_verif.xml index 23a5b3bda5..0e71831e84 100644 --- a/vector/src/main/res/layout/item_emoji_verif.xml +++ b/vector/src/main/res/layout/item_emoji_verif.xml @@ -10,6 +10,7 @@ diff --git a/vector/src/main/res/layout/item_public_room.xml b/vector/src/main/res/layout/item_public_room.xml index 01c44a138f..1364cf77cb 100644 --- a/vector/src/main/res/layout/item_public_room.xml +++ b/vector/src/main/res/layout/item_public_room.xml @@ -43,6 +43,7 @@ diff --git a/vector/src/main/res/layout/item_timeline_event_merged_room_creation_stub.xml b/vector/src/main/res/layout/item_timeline_event_merged_room_creation_stub.xml index d7f49da9e3..0daf1672c3 100644 --- a/vector/src/main/res/layout/item_timeline_event_merged_room_creation_stub.xml +++ b/vector/src/main/res/layout/item_timeline_event_merged_room_creation_stub.xml @@ -63,12 +63,12 @@ - \ No newline at end of file diff --git a/vector/src/main/res/layout/item_user_list_header.xml b/vector/src/main/res/layout/item_user_list_header.xml index e3aae0e570..4b9f7ca9b9 100644 --- a/vector/src/main/res/layout/item_user_list_header.xml +++ b/vector/src/main/res/layout/item_user_list_header.xml @@ -1,13 +1,12 @@ - \ No newline at end of file diff --git a/vector/src/main/res/layout/item_verification_decimal_code.xml b/vector/src/main/res/layout/item_verification_decimal_code.xml index 2eeb6902dc..0ba114c64b 100644 --- a/vector/src/main/res/layout/item_verification_decimal_code.xml +++ b/vector/src/main/res/layout/item_verification_decimal_code.xml @@ -1,8 +1,8 @@ diff --git a/vector/src/main/res/layout/view_sign_out_bottom_sheet_action_button.xml b/vector/src/main/res/layout/view_sign_out_bottom_sheet_action_button.xml index 2a9c374f2d..4543cfcb46 100644 --- a/vector/src/main/res/layout/view_sign_out_bottom_sheet_action_button.xml +++ b/vector/src/main/res/layout/view_sign_out_bottom_sheet_action_button.xml @@ -32,12 +32,12 @@ + android:textColor="?vctr_content_primary" /> diff --git a/vector/src/main/res/layout/view_stub_room_member_profile_header.xml b/vector/src/main/res/layout/view_stub_room_member_profile_header.xml index fe17be0e2f..aa489b1c00 100644 --- a/vector/src/main/res/layout/view_stub_room_member_profile_header.xml +++ b/vector/src/main/res/layout/view_stub_room_member_profile_header.xml @@ -41,11 +41,11 @@