From 5fb890ef8362274be50714e742489b1b45b777de Mon Sep 17 00:00:00 2001 From: Adhiambo Peres <59600948+adhiamboperes@users.noreply.github.com> Date: Wed, 3 Apr 2024 14:46:25 +0300 Subject: [PATCH 1/3] Addressed general feedback --- .../customview/OppiaCurveBackgroundView.kt | 2 +- .../OnboardingFragmentPresenter.kt | 14 ++++++------ app/src/main/res/values/component_colors.xml | 1 - .../app/onboarding/OnboardingFragmentTest.kt | 22 ++++++++++++++----- .../assets/kdoc_validity_exemptions.textproto | 1 - scripts/assets/test_file_exemptions.textproto | 1 + 6 files changed, 25 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/org/oppia/android/app/customview/OppiaCurveBackgroundView.kt b/app/src/main/java/org/oppia/android/app/customview/OppiaCurveBackgroundView.kt index 9f60f2c4cca..8aac84a3c8b 100644 --- a/app/src/main/java/org/oppia/android/app/customview/OppiaCurveBackgroundView.kt +++ b/app/src/main/java/org/oppia/android/app/customview/OppiaCurveBackgroundView.kt @@ -38,7 +38,7 @@ class OppiaCurveBackgroundView @JvmOverloads constructor( resourceHandler.getLayoutDirection() == ViewCompat.LAYOUT_DIRECTION_RTL } - private var customBackgroundColor = Color.WHITE // Default color + private var customBackgroundColor = Color.WHITE // Default color. private lateinit var paint: Paint private lateinit var path: Path diff --git a/app/src/main/java/org/oppia/android/app/onboardingv2/OnboardingFragmentPresenter.kt b/app/src/main/java/org/oppia/android/app/onboardingv2/OnboardingFragmentPresenter.kt index 55d41f7fd4c..81b0524db91 100644 --- a/app/src/main/java/org/oppia/android/app/onboardingv2/OnboardingFragmentPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/onboardingv2/OnboardingFragmentPresenter.kt @@ -26,14 +26,14 @@ class OnboardingFragmentPresenter @Inject constructor( /* attachToRoot= */ false ) - binding.let { - it.lifecycleOwner = fragment - } + binding.apply { + lifecycleOwner = fragment - binding.onboardingLanguageTitle.text = appLanguageResourceHandler.getStringInLocaleWithWrapping( - R.string.onboarding_language_activity_title, - appLanguageResourceHandler.getStringInLocale(R.string.app_name) - ) + onboardingLanguageTitle.text = appLanguageResourceHandler.getStringInLocaleWithWrapping( + R.string.onboarding_language_activity_title, + appLanguageResourceHandler.getStringInLocale(R.string.app_name) + ) + } return binding.root } diff --git a/app/src/main/res/values/component_colors.xml b/app/src/main/res/values/component_colors.xml index 688327d2d67..3de87773381 100644 --- a/app/src/main/res/values/component_colors.xml +++ b/app/src/main/res/values/component_colors.xml @@ -307,5 +307,4 @@ @color/color_palette_white_text_color @color/color_palette_onboarding_primary_color @color/color_palette_onboarding_primary_text_color - diff --git a/app/src/sharedTest/java/org/oppia/android/app/onboarding/OnboardingFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/onboarding/OnboardingFragmentTest.kt index 342f5a5e703..5fe73a74d55 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/onboarding/OnboardingFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/onboarding/OnboardingFragmentTest.kt @@ -124,13 +124,23 @@ import javax.inject.Singleton qualifiers = "port-xxhdpi" ) class OnboardingFragmentTest { - @get:Rule val initializeDefaultLocaleRule = InitializeDefaultLocaleRule() + @get:Rule + val initializeDefaultLocaleRule = InitializeDefaultLocaleRule() - @get:Rule val oppiaTestRule = OppiaTestRule() - @Inject lateinit var testCoroutineDispatchers: TestCoroutineDispatchers - @Inject lateinit var htmlParserFactory: HtmlParser.Factory - @Inject lateinit var context: Context - @Inject lateinit var appLanguageLocaleHandler: AppLanguageLocaleHandler + @get:Rule + val oppiaTestRule = OppiaTestRule() + + @Inject + lateinit var testCoroutineDispatchers: TestCoroutineDispatchers + + @Inject + lateinit var htmlParserFactory: HtmlParser.Factory + + @Inject + lateinit var context: Context + + @Inject + lateinit var appLanguageLocaleHandler: AppLanguageLocaleHandler @Inject @field:DefaultResourceBucketName diff --git a/scripts/assets/kdoc_validity_exemptions.textproto b/scripts/assets/kdoc_validity_exemptions.textproto index fb49c21573b..d95675679d3 100644 --- a/scripts/assets/kdoc_validity_exemptions.textproto +++ b/scripts/assets/kdoc_validity_exemptions.textproto @@ -3,7 +3,6 @@ exempted_file_path: "app/src/main/java/org/oppia/android/app/application/Applica exempted_file_path: "app/src/main/java/org/oppia/android/app/application/ApplicationInjectorProvider.kt" exempted_file_path: "app/src/main/java/org/oppia/android/app/application/ApplicationStartupListenerModule.kt" exempted_file_path: "app/src/main/java/org/oppia/android/app/administratorcontrols/RouteToProfileListListener.kt" -exempted_file_path: "app/src/main/java/org/oppia/android/app/customview/OppiaCurveBackgroundView.kt" exempted_file_path: "app/src/main/java/org/oppia/android/app/notice/AutomaticAppDeprecationNoticeDialogFragmentPresenter.kt" exempted_file_path: "app/src/main/java/org/oppia/android/app/devoptions/DeveloperOptionsActivityPresenter.kt" exempted_file_path: "app/src/main/java/org/oppia/android/app/devoptions/DeveloperOptionsFragment.kt" diff --git a/scripts/assets/test_file_exemptions.textproto b/scripts/assets/test_file_exemptions.textproto index a210716305b..585b7d17858 100644 --- a/scripts/assets/test_file_exemptions.textproto +++ b/scripts/assets/test_file_exemptions.textproto @@ -254,6 +254,7 @@ exempted_file_path: "app/src/main/java/org/oppia/android/app/onboarding/Onboardi exempted_file_path: "app/src/main/java/org/oppia/android/app/onboarding/OnboardingViewPagerViewModel.kt" exempted_file_path: "app/src/main/java/org/oppia/android/app/onboarding/RouteToProfileListListener.kt" exempted_file_path: "app/src/main/java/org/oppia/android/app/onboarding/ViewPagerSlide.kt" +exempted_file_path: "app/src/main/java/org/oppia/android/app/onboardingv2/OnboardingFragmentPresenter.kt" exempted_file_path: "app/src/main/java/org/oppia/android/app/ongoingtopiclist/OngoingTopicItemViewModel.kt" exempted_file_path: "app/src/main/java/org/oppia/android/app/ongoingtopiclist/OngoingTopicListActivityPresenter.kt" exempted_file_path: "app/src/main/java/org/oppia/android/app/ongoingtopiclist/OngoingTopicListFragment.kt" From adbdbed335884eee15f85b58596af2e2f3cad59b Mon Sep 17 00:00:00 2001 From: Adhiambo Peres <59600948+adhiamboperes@users.noreply.github.com> Date: Wed, 3 Apr 2024 18:08:22 +0300 Subject: [PATCH 2/3] Fix curve background for landscape orientation --- .../customview/OppiaCurveBackgroundView.kt | 42 +++++++++++++++---- ...arding_app_language_selection_fragment.xml | 30 +++++++------ ...arding_app_language_selection_fragment.xml | 4 +- ...arding_app_language_selection_fragment.xml | 19 +++------ .../main/res/values-night/color_palette.xml | 2 +- app/src/main/res/values/styles.xml | 2 +- 6 files changed, 57 insertions(+), 42 deletions(-) diff --git a/app/src/main/java/org/oppia/android/app/customview/OppiaCurveBackgroundView.kt b/app/src/main/java/org/oppia/android/app/customview/OppiaCurveBackgroundView.kt index 8aac84a3c8b..6ee0b380c47 100644 --- a/app/src/main/java/org/oppia/android/app/customview/OppiaCurveBackgroundView.kt +++ b/app/src/main/java/org/oppia/android/app/customview/OppiaCurveBackgroundView.kt @@ -1,6 +1,8 @@ package org.oppia.android.app.customview import android.content.Context +import android.content.res.Configuration +import android.content.res.Resources import android.content.res.TypedArray import android.graphics.Canvas import android.graphics.Color @@ -38,6 +40,8 @@ class OppiaCurveBackgroundView @JvmOverloads constructor( resourceHandler.getLayoutDirection() == ViewCompat.LAYOUT_DIRECTION_RTL } + private val orientation = Resources.getSystem().configuration.orientation + private var customBackgroundColor = Color.WHITE // Default color. private lateinit var paint: Paint @@ -66,17 +70,37 @@ class OppiaCurveBackgroundView @JvmOverloads constructor( val width = this.width.toFloat() val height = this.height.toFloat() - val controlPoint1X = width * 0.55f - val controlPoint1Y = 0f - - val controlPoint2X = width * 0.52f - val controlPoint2Y = height * 0.2f - - val controlPoint3X = width * 1f - val controlPoint3Y = height * 0.1f + val controlPoint1X: Float + val controlPoint1Y: Float + + val controlPoint2X: Float + val controlPoint2Y: Float + + val controlPoint3X: Float + val controlPoint3Y: Float + + if (orientation == Configuration.ORIENTATION_PORTRAIT) { + controlPoint1X = width * 0.55f + controlPoint1Y = 0f + controlPoint2X = width * 0.52f + controlPoint2Y = height * 0.2f + controlPoint3X = width * 1f + controlPoint3Y = height * 0.1f + } else { + controlPoint1X = width * 0.40f + controlPoint1Y = 0f + controlPoint2X = width * 0.60f + controlPoint2Y = height * 0.40f + controlPoint3X = width * 1f + controlPoint3Y = height * 0.2f + } path.reset() - path.moveTo(0f, height * 0.1f) + if (orientation == Configuration.ORIENTATION_PORTRAIT) { + path.moveTo(0f, height * 0.10f) + } else { + path.moveTo(0f, height * 0.30f) + } path.cubicTo( controlPoint1X, controlPoint1Y, diff --git a/app/src/main/res/layout-land/onboarding_app_language_selection_fragment.xml b/app/src/main/res/layout-land/onboarding_app_language_selection_fragment.xml index 37ff3fc566a..994d339e468 100644 --- a/app/src/main/res/layout-land/onboarding_app_language_selection_fragment.xml +++ b/app/src/main/res/layout-land/onboarding_app_language_selection_fragment.xml @@ -11,8 +11,9 @@ @@ -22,6 +23,7 @@ style="@style/OnboardingLanguageSubtitleStyle" android:layout_marginTop="@dimen/onboarding_shared_margin_small" android:text="@string/onboarding_language_activity_subtitle" + android:textSize="@dimen/onboarding_shared_text_size_medium" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/onboarding_language_title" /> @@ -29,7 +31,6 @@ + app:layout_constraintGuide_percent="0.20" /> + app:layout_constraintStart_toStartOf="parent" /> + app:layout_constraintWidth_percent="0.40"> + app:layout_constraintStart_toStartOf="@id/onboarding_language_explanation" + app:layout_constraintWidth_percent="0.50" /> diff --git a/app/src/main/res/layout-sw600dp-land/onboarding_app_language_selection_fragment.xml b/app/src/main/res/layout-sw600dp-land/onboarding_app_language_selection_fragment.xml index df7ccc2de4d..a5a05ef77eb 100644 --- a/app/src/main/res/layout-sw600dp-land/onboarding_app_language_selection_fragment.xml +++ b/app/src/main/res/layout-sw600dp-land/onboarding_app_language_selection_fragment.xml @@ -45,14 +45,14 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" - app:layout_constraintGuide_percent="0.35" /> + app:layout_constraintGuide_percent="0.34" /> + app:layout_constraintGuide_percent="0.45" /> - - + app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintGuide_percent="0.30" /> + app:layout_constraintGuide_percent="0.40" /> @color/color_def_black_24 @color/color_def_white @color/color_def_forest_green - @color/color_def_oppia_green + @color/color_def_dark_green @color/color_def_dark_green @color/color_def_oppia_green @color/color_def_highlight_blue_darker diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index d0edabebada..12a2e8eb25a 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -658,7 +658,7 @@ match_parent wrap_content @color/component_color_onboarding_shared_white_color - @dimen/onboarding_shared_margin_medium + @dimen/onboarding_shared_margin_medium_small @dimen/onboarding_shared_text_size_small sans-serif From 4f0c57b26fbebcb3aec110407da7cfe7e97b6a63 Mon Sep 17 00:00:00 2001 From: Adhiambo Peres <59600948+adhiamboperes@users.noreply.github.com> Date: Wed, 3 Apr 2024 18:27:28 +0300 Subject: [PATCH 3/3] Flatten Bg drawable --- .../main/res/drawable/dropdown_background.xml | 29 +++++-------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/app/src/main/res/drawable/dropdown_background.xml b/app/src/main/res/drawable/dropdown_background.xml index 3eca06cfe8c..c6cca728b36 100644 --- a/app/src/main/res/drawable/dropdown_background.xml +++ b/app/src/main/res/drawable/dropdown_background.xml @@ -1,23 +1,8 @@ - - - - - - - - - - - - - - + + + +