Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/new-onboarding-screen' into on…
Browse files Browse the repository at this point in the history
…boarding-profile-type-screen

# Conflicts:
#	app/src/main/res/values/component_colors.xml
#	scripts/assets/test_file_exemptions.textproto
  • Loading branch information
adhiamboperes committed Apr 3, 2024
2 parents 5bd5239 + 187726c commit 3d2313c
Show file tree
Hide file tree
Showing 12 changed files with 89 additions and 80 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -38,7 +40,9 @@ class OppiaCurveBackgroundView @JvmOverloads constructor(
resourceHandler.getLayoutDirection() == ViewCompat.LAYOUT_DIRECTION_RTL
}

private var customBackgroundColor = Color.WHITE // Default color
private val orientation = Resources.getSystem().configuration.orientation

private var customBackgroundColor = Color.WHITE // Default color.

private lateinit var paint: Paint
private lateinit var path: Path
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,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)
)
}

binding.onboardingLanguageLetsGoButton.setOnClickListener {
val intent = OnboardingProfileTypeActivity.createOnboardingProfileTypeActivityIntent(activity)
Expand Down
29 changes: 7 additions & 22 deletions app/src/main/res/drawable/dropdown_background.xml
Original file line number Diff line number Diff line change
@@ -1,23 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/component_color_shared_white_background_color" />
<corners
android:bottomLeftRadius="@dimen/onboarding_shared_corner_radius"
android:bottomRightRadius="@dimen/onboarding_shared_corner_radius" />
</shape>
</item>
<item
android:bottom="2dp"
android:left="1dp"
android:right="2dp"
android:top="0dp">
<shape android:shape="rectangle">
<solid android:color="@color/component_color_shared_white_background_color" />
<corners
android:bottomLeftRadius="@dimen/onboarding_shared_corner_radius"
android:bottomRightRadius="@dimen/onboarding_shared_corner_radius" />
</shape>
</item>
</layer-list>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/component_color_shared_white_background_color" />
<corners
android:bottomLeftRadius="@dimen/onboarding_shared_corner_radius"
android:bottomRightRadius="@dimen/onboarding_shared_corner_radius" />
</shape>
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
<TextView
android:id="@+id/onboarding_language_title"
style="@style/OnboardingHeaderStyle"
android:layout_marginTop="@dimen/onboarding_shared_margin_medium_large"
android:layout_marginTop="@dimen/onboarding_shared_margin_medium_small"
android:text="@string/onboarding_language_activity_title"
android:textSize="@dimen/onboarding_shared_text_size_large"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
Expand All @@ -22,14 +23,14 @@
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" />

<TextView
android:id="@+id/onboarding_language_text"
style="@style/OnboardingLanguageMessageStyle"
android:layout_marginTop="@dimen/onboarding_shared_margin_medium_small"
android:text="@string/onboarding_language_activity_text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand All @@ -40,7 +41,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.40" />
app:layout_constraintGuide_percent="0.20" />

<org.oppia.android.app.customview.OppiaCurveBackgroundView
android:id="@+id/onboarding_app_language_background"
Expand All @@ -52,9 +53,10 @@

<ImageView
android:id="@+id/onboarding_app_language_image"
android:layout_width="132dp"
android:layout_height="138dp"
android:layout_marginEnd="@dimen/onboarding_shared_margin_2xl"
android:layout_width="116dp"
android:layout_height="120dp"
android:layout_marginTop="@dimen/onboarding_shared_margin_small"
android:layout_marginEnd="@dimen/onboarding_shared_margin_medium_small"
android:contentDescription="@string/onboarding_otter_content_description"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/onboarding_language_title"
Expand All @@ -63,28 +65,24 @@
<TextView
android:id="@+id/onboarding_language_label"
style="@style/OnboardingLanguageLabelStyle"
android:layout_marginTop="@dimen/onboarding_shared_margin_medium_large"
android:text="@string/onboarding_language_activity_select_label"
android:textSize="@dimen/onboarding_shared_text_size_medium"
app:layout_constraintBottom_toTopOf="@id/onboarding_language_dropdown_background"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/onboarding_language_center_guide" />
app:layout_constraintStart_toStartOf="parent" />

<RelativeLayout
android:id="@+id/onboarding_language_dropdown_background"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/onboarding_shared_margin_5xl"
android:layout_marginEnd="@dimen/onboarding_shared_margin_5xl"
android:layout_marginBottom="@dimen/onboarding_shared_margin_small"
android:background="@drawable/dropdown_background"
android:elevation="@dimen/onboarding_shared_elevation"
android:padding="@dimen/onboarding_shared_padding_small"
app:layout_constraintBottom_toTopOf="@id/onboarding_language_explanation"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/onboarding_language_label"
app:layout_constraintWidth_percent="0.30"
app:layout_constraintBottom_toTopOf="@id/onboarding_language_explanation">
app:layout_constraintWidth_percent="0.40">

<ImageView
android:id="@+id/onboarding_language_dropdown_icon"
Expand Down Expand Up @@ -138,7 +136,7 @@
android:text="@string/onboarding_language_activity_button_text"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@id/onboarding_language_explanation"
app:layout_constraintWidth_percent="0.40"
app:layout_constraintStart_toStartOf="@id/onboarding_language_explanation" />
app:layout_constraintStart_toStartOf="@id/onboarding_language_explanation"
app:layout_constraintWidth_percent="0.50" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
Original file line number Diff line number Diff line change
Expand Up @@ -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" />

<androidx.constraintlayout.widget.Guideline
android:id="@+id/onboarding_language_center_guide"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.50" />
app:layout_constraintGuide_percent="0.45" />

<org.oppia.android.app.customview.OppiaCurveBackgroundView
android:id="@+id/onboarding_app_language_background"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,14 @@
android:layout_height="match_parent"
android:background="@color/component_color_onboarding_shared_green_color">

<androidx.constraintlayout.widget.Guideline
android:id="@+id/onboarding_language_header_guide"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.10" />

<TextView
android:id="@+id/onboarding_language_title"
style="@style/OnboardingHeaderStyle"
android:layout_marginTop="@dimen/onboarding_shared_margin_xl"
android:text="@string/onboarding_language_activity_title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/onboarding_language_header_guide" />
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/onboarding_language_subtitle"
Expand All @@ -44,14 +38,14 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.38" />
app:layout_constraintGuide_percent="0.30" />

<androidx.constraintlayout.widget.Guideline
android:id="@+id/onboarding_language_center_guide"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.50" />
app:layout_constraintGuide_percent="0.40" />

<org.oppia.android.app.customview.OppiaCurveBackgroundView
android:id="@+id/onboarding_app_language_background"
Expand All @@ -63,8 +57,8 @@

<ImageView
android:id="@+id/onboarding_app_language_image"
android:layout_width="132dp"
android:layout_height="148dp"
android:layout_width="130dp"
android:layout_height="134dp"
android:contentDescription="@string/onboarding_otter_content_description"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand All @@ -86,7 +80,6 @@
android:layout_marginStart="@dimen/onboarding_shared_margin_4xl"
android:layout_marginTop="@dimen/onboarding_shared_margin_medium_small"
android:layout_marginEnd="@dimen/onboarding_shared_margin_4xl"
android:layout_marginBottom="@dimen/onboarding_shared_margin_large"
android:background="@drawable/dropdown_background"
android:elevation="@dimen/onboarding_shared_elevation"
android:padding="@dimen/onboarding_shared_padding_small"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-night/color_palette.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<color name="color_palette_toolbar_shadow_color">@color/color_def_black_24</color>
<color name="color_palette_toolbar_text_color">@color/color_def_white</color>
<color name="color_palette_secondary_toolbar_color">@color/color_def_forest_green</color>
<color name="color_palette_secondary_button_background_trim_color">@color/color_def_oppia_green</color>
<color name="color_palette_secondary_button_background_trim_color">@color/color_def_dark_green</color>
<color name="color_palette_status_bar_color">@color/color_def_dark_green</color>
<color name="color_palette_action_bar_color">@color/color_def_oppia_green</color>
<color name="color_palette_highlighted_background_color">@color/color_def_highlight_blue_darker</color>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values/component_colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -308,5 +308,4 @@
<color name="component_color_onboarding_shared_green_color">@color/color_palette_onboarding_primary_color</color>
<color name="component_color_onboarding_shared_text_color">@color/color_palette_onboarding_primary_text_color</color>
<color name="component_color_onboarding_profile_type_background_color">@color/color_palette_onboarding_profile_type_background_color</color>

</resources>
2 changes: 1 addition & 1 deletion app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textColor">@color/component_color_onboarding_shared_white_color</item>
<item name="android:layout_marginTop">@dimen/onboarding_shared_margin_medium</item>
<item name="android:layout_marginTop">@dimen/onboarding_shared_margin_medium_small</item>
<item name="android:textSize">@dimen/onboarding_shared_text_size_small</item>
<item name="android:fontFamily">sans-serif</item>
</style>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion scripts/assets/kdoc_validity_exemptions.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions scripts/assets/test_file_exemptions.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -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/onboardingv2/OnboardingProfileTypeActivityPresenter.kt"
exempted_file_path: "app/src/main/java/org/oppia/android/app/onboardingv2/OnboardingProfileTypeFragmentPresenter.kt"
exempted_file_path: "app/src/main/java/org/oppia/android/app/ongoingtopiclist/OngoingTopicItemViewModel.kt"
Expand Down

0 comments on commit 3d2313c

Please sign in to comment.