From ec5a4f0243bb4b476fe8143ae7005b5f34716631 Mon Sep 17 00:00:00 2001 From: Sneha Datta Date: Tue, 29 Oct 2024 12:46:12 +0530 Subject: [PATCH 1/2] Fix #5329: Add color formatting to static check messages (#5540) ## Explanation Fixes #5329 This PR implements color-coded messages for static checks to improve experience. Error messages are displayed in red for failing checks, while warnings are shown in yellow. Successful checks are indicated with green messages. ## Essential Checklist - [x] The PR title and explanation each start with "Fix #bugnum: " (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".) - [x] Any changes to [scripts/assets](https://github.com/oppia/oppia-android/tree/develop/scripts/assets) files have their rationale included in the PR explanation. - [x] The PR follows the [style guide](https://github.com/oppia/oppia-android/wiki/Coding-style-guide). - [x] The PR does not contain any unnecessary code changes from Android Studio ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#undo-unnecessary-changes)). - [x] The PR is made from a branch that's **not** called "develop" and is up-to-date with "develop". - [x] The PR is **assigned** to the appropriate reviewers ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#clarification-regarding-assignees-and-reviewers-section)). ## For UI-specific PRs only If your PR includes UI-related changes, then: - Add screenshots for portrait/landscape for both a tablet & phone of the before & after UI changes - For the screenshots above, include both English and pseudo-localized (RTL) screenshots (see [RTL guide](https://github.com/oppia/oppia-android/wiki/RTL-Guidelines)) - Add a video showing the full UX flow with a screen reader enabled (see [accessibility guide](https://github.com/oppia/oppia-android/wiki/Accessibility-A11y-Guide)) - For PRs introducing new UI elements or color changes, both light and dark mode screenshots must be included - Add a screenshot demonstrating that you ran affected Espresso tests locally & that they're passing --------- Co-authored-by: Adhiambo Peres <59600948+adhiamboperes@users.noreply.github.com> --- scripts/buf_lint_check.sh | 8 +++++--- scripts/buildifier_lint_check.sh | 6 ++++-- scripts/checkstyle_lint_check.sh | 6 ++++-- scripts/feature_flags_check.sh | 10 ++++++---- scripts/formatting.sh | 30 ++++++++++++++++++++++++++++++ scripts/ktlint_lint_check.sh | 8 +++++--- scripts/pre-push.sh | 4 +++- 7 files changed, 57 insertions(+), 15 deletions(-) create mode 100644 scripts/formatting.sh diff --git a/scripts/buf_lint_check.sh b/scripts/buf_lint_check.sh index c5cbfed35ec..b355f2af16b 100644 --- a/scripts/buf_lint_check.sh +++ b/scripts/buf_lint_check.sh @@ -1,5 +1,7 @@ #!/bin/bash +source scripts/formatting.sh + jar_file_path=$? config_file_path=$? os_type=$? @@ -15,11 +17,11 @@ lint_protobuf_files() { status=$? if [ "$status" = 0 ] ; then - echo "Protobuf lint check completed successfully" + echo_success "Protobuf lint check completed successfully" exit 0 else echo "********************************" - echo "Protobuf lint check issues found. Please fix them before pushing your code." + echo_error "Protobuf lint check issues found. Please fix them before pushing your code." echo "********************************" exit 1 fi @@ -57,7 +59,7 @@ check_os_type() { elif [[ "$OSTYPE" == "darwin"* ]]; then os_type="Darwin" else - echo "Protobuf lint check not available on $OSTYPE" + echo_error "Protobuf lint check not available on $OSTYPE" exit 0 fi } diff --git a/scripts/buildifier_lint_check.sh b/scripts/buildifier_lint_check.sh index 52e0857468e..b56487f6b2f 100644 --- a/scripts/buildifier_lint_check.sh +++ b/scripts/buildifier_lint_check.sh @@ -1,5 +1,7 @@ #!/bin/bash +source scripts/formatting.sh + echo "********************************" echo "Checking Bazel file formatting" echo "********************************" @@ -19,12 +21,12 @@ $buildifier_file_path --lint=warn --mode=check --warnings=-native-android,+out-o status=$? if [ "$status" = 0 ] ; then - echo "Buildifier lint check completed successfully" + echo_success "Buildifier lint check completed successfully" exit 0 else # Assume any lint output or non-zero exit code is a failure. echo "********************************" - echo "Buildifier issue found." + echo_error "Buildifier issue found." echo "Please fix the above issues." echo "********************************" exit 1 diff --git a/scripts/checkstyle_lint_check.sh b/scripts/checkstyle_lint_check.sh index 668be1ba670..1b682d8b615 100644 --- a/scripts/checkstyle_lint_check.sh +++ b/scripts/checkstyle_lint_check.sh @@ -1,5 +1,7 @@ #!/bin/bash +source scripts/formatting.sh + echo "********************************" echo "Checking Java file formatting" echo "********************************" @@ -23,11 +25,11 @@ echo $lint_results if [ "$lint_command_result" -ne 0 ] || [ -z "$lint_results" ] || [[ ${lint_results} == *"[WARN]"* ]]; then # Assume any lint output or non-zero exit code is a failure. echo "********************************" - echo "Checkstyle issue found." + echo_error "Checkstyle issue found." echo "Please fix the above issues." echo "********************************" exit 1 else - echo "Checkstyle lint check completed successfully" + echo_success "Checkstyle lint check completed successfully" exit 0 fi diff --git a/scripts/feature_flags_check.sh b/scripts/feature_flags_check.sh index 48e61153a70..92b0e07a10e 100644 --- a/scripts/feature_flags_check.sh +++ b/scripts/feature_flags_check.sh @@ -1,5 +1,7 @@ #!/bin/bash +source scripts/formatting.sh + echo "********************************" echo "Running feature flag checks" echo "********************************" @@ -120,7 +122,7 @@ function perform_checks_on_feature_flags() { in_array=$(item_in_array "$element" "${imported_classes[@]}") if [[ $in_array -ne 1 ]]; then failed_checks=$((failed_checks + 1)) - echo "$element is not imported in the constructor argument in $file_path at line $imports_line_number" + echo_error "$element is not imported in the constructor argument in $file_path at line $imports_line_number" fi done @@ -128,16 +130,16 @@ function perform_checks_on_feature_flags() { in_array=$(item_in_array "$element" "${flags_added_to_map[@]}") if [[ $in_array -ne 1 ]]; then failed_checks=$((failed_checks + 1)) - echo "$element is not added to the logging map in $file_path at line $flags_map_line_number" + echo_error "$element is not added to the logging map in $file_path at line $flags_map_line_number" fi done if [[ $failed_checks -eq 0 ]]; then - echo "Feature flag checks completed successfully" + echo_success "Feature flag checks completed successfully" exit 0 else echo "********************************" - echo "Feature flag issues found." + echo_error "Feature flag issues found." echo "Please fix the above issues." echo "********************************" exit 1 diff --git a/scripts/formatting.sh b/scripts/formatting.sh new file mode 100644 index 00000000000..0fd2c2dac94 --- /dev/null +++ b/scripts/formatting.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +#Defines color codes for output formatting + +# Red color for error messages +RED='\033[0;31m' + +# Green color for success messages +GREEN='\033[0;32m' + +# Yellow color for warnings messages +YELLOW='\033[0;33m' + +# No color, used to reset the color after each message +NC='\033[0m' + +# Function to print an error message in red +function echo_error() { + echo -e "${RED}$1${NC}" +} + +# Function to print a success message in green +function echo_success() { + echo -e "${GREEN}$1${NC}" +} + +# Function to print a warning message in yellow +function echo_warning() { + echo -e "${YELLOW}$1${NC}" +} diff --git a/scripts/ktlint_lint_check.sh b/scripts/ktlint_lint_check.sh index 2713b88d0e0..dab25e7bd64 100755 --- a/scripts/ktlint_lint_check.sh +++ b/scripts/ktlint_lint_check.sh @@ -1,5 +1,7 @@ #!/bin/bash +source scripts/formatting.sh + echo "********************************" echo "Checking code formatting" echo "********************************" @@ -19,15 +21,15 @@ java -jar $jar_file_path --android app/src/**/*.kt data/src/**/*.kt domain/src/* status=$? if [ "$status" = 0 ] ; then - echo "Lint completed successfully." + echo_success "Lint completed successfully." exit 0 else echo "********************************" - echo "Ktlint issue found." + echo_error "Ktlint issue found." echo "Please fix the above issues. You can also use the java -jar $jar_file_path -F --android domain/src/**/*.kt utility/src/**/*.kt data/src/**/*.kt app/src/**/*.kt testing/src/**/*.kt scripts/src/**/*.kt instrumentation/src/**/*.kt command to fix the most common issues." - echo "Please note, there might be a possibility where the above command will not fix the issue. + echo_warning "Please note, there might be a possibility where the above command will not fix the issue. In that case, you will have to fix it yourself." echo "********************************" exit 1 diff --git a/scripts/pre-push.sh b/scripts/pre-push.sh index 13d37eeb20e..ea2878926de 100755 --- a/scripts/pre-push.sh +++ b/scripts/pre-push.sh @@ -1,5 +1,7 @@ #!/bin/bash +source scripts/formatting.sh + # This script will run the pre-push checks in the given order # - ktlint # - checkstyle @@ -7,7 +9,7 @@ # - (others in the future) if bash scripts/ktlint_lint_check.sh && bash scripts/checkstyle_lint_check.sh && bash scripts/buf_lint_check.sh ; then - echo "All checks passed successfully" + echo_success "All checks passed successfully" exit 0 else exit 1 From 2ba2cbc0136ee9382c1febf88f4c9fd2758947c5 Mon Sep 17 00:00:00 2001 From: Tanish Moral <134790673+TanishMoral11@users.noreply.github.com> Date: Wed, 30 Oct 2024 19:06:17 +0530 Subject: [PATCH 2/2] Fix #2652 : Improve splash screen implementation with new drawable and updated styles (#5559) Fixes #2652: This PR aims to enhance the splash screen implementation by making the following changes: - **splash_image.xml**: Created a new layer-list drawable that includes a background color (`@color/oppiaPrimaryLight`) and centers the splash image (`@drawable/splash_page`). - **splash_page.xml**: Modified the path data for the splash image and removed the old clip-path to ensure proper rendering. - **styles.xml**: Updated the `SplashScreenTheme` to reference the new `splash_image` drawable and set `adjustViewBounds` to true, allowing for better handling of different screen sizes. These changes are intended to improve the visual consistency and responsiveness of the splash screen across various devices. ## Essential Checklist - [x] The PR title and explanation each start with "Fix #bugnum: " (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ..."). - [x] Any changes to `scripts/assets` files have their rationale included in the PR explanation. - [x] The PR follows the [style guide](https://github.com/oppia/oppia-android/wiki/Coding-style-guide). - [x] The PR does not contain any unnecessary code changes from Android Studio ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#undo-unnecessary-changes)). - [x] The PR is made from a branch that's **not** called "develop" and is up-to-date with "develop". - [x] The PR is **assigned** to the appropriate reviewers ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#clarification-regarding-assignees-and-reviewers-section)). Before : https://github.com/user-attachments/assets/161eb1ca-57b1-4b63-829a-de41f1b99702 After : https://github.com/user-attachments/assets/fcd480ff-aabd-4fe3-9887-b9bf50b276ac --------- Co-authored-by: Adhiambo Peres <59600948+adhiamboperes@users.noreply.github.com> --- app/src/main/res/drawable/splash_image.xml | 5 +++++ app/src/main/res/drawable/splash_page.xml | 6 ------ app/src/main/res/values/styles.xml | 3 ++- 3 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 app/src/main/res/drawable/splash_image.xml diff --git a/app/src/main/res/drawable/splash_image.xml b/app/src/main/res/drawable/splash_image.xml new file mode 100644 index 00000000000..d71dfdee03e --- /dev/null +++ b/app/src/main/res/drawable/splash_image.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/app/src/main/res/drawable/splash_page.xml b/app/src/main/res/drawable/splash_page.xml index 96790799d5d..a95dba7e5eb 100644 --- a/app/src/main/res/drawable/splash_page.xml +++ b/app/src/main/res/drawable/splash_page.xml @@ -3,12 +3,6 @@ android:height="640dp" android:viewportWidth="360" android:viewportHeight="640"> - - - - diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 61eaea05390..32fcd43fce6 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -74,7 +74,8 @@