diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index d231b3d1644..c3020e6211e 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -32,7 +32,6 @@
android:theme="@style/OppiaThemeWithoutActionBar" />
(context.resources.getString(R.string.onboarding_slide_0_title))
val title = ObservableField(context.resources.getString(R.string.onboarding_slide_0_title))
val description = ObservableField(context.resources.getString(R.string.onboarding_slide_0_description))
+ private val orientation = Resources.getSystem().configuration.orientation
init {
initializingSlide(viewPagerSlide)
@@ -22,25 +25,41 @@ class OnboardingSlideViewModel(val context: Context, viewPagerSlide: ViewPagerSl
private fun initializingSlide(viewPagerSlide: ViewPagerSlide) {
when (viewPagerSlide) {
ViewPagerSlide.SLIDE_0 -> {
- slideImage.set(R.drawable.ic_onboarding_0)
+ if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
+ slideImage.set(R.drawable.ic_landscape_onboarding_0)
+ } else if (orientation == Configuration.ORIENTATION_PORTRAIT){
+ slideImage.set(R.drawable.ic_onboarding_0)
+ }
contentDescription.set(context.resources.getString(R.string.onboarding_slide_0_title))
title.set(context.resources.getString(R.string.onboarding_slide_0_title))
description.set(context.resources.getString(R.string.onboarding_slide_0_description))
}
ViewPagerSlide.SLIDE_1 -> {
- slideImage.set(R.drawable.ic_onboarding_1)
+ if (orientation == Configuration.ORIENTATION_LANDSCAPE){
+ slideImage.set(R.drawable.ic_landscape_onboarding_1)
+ } else if (orientation == Configuration.ORIENTATION_PORTRAIT){
+ slideImage.set(R.drawable.ic_onboarding_1)
+ }
contentDescription.set(context.resources.getString(R.string.onboarding_slide_1_title))
title.set(context.resources.getString(R.string.onboarding_slide_1_title))
description.set(context.resources.getString(R.string.onboarding_slide_1_description))
}
ViewPagerSlide.SLIDE_2 -> {
- slideImage.set(R.drawable.ic_onboarding_2)
+ if (orientation == Configuration.ORIENTATION_LANDSCAPE){
+ slideImage.set(R.drawable.ic_landscape_onboarding_2)
+ } else if(orientation == Configuration.ORIENTATION_PORTRAIT){
+ slideImage.set(R.drawable.ic_onboarding_2)
+ }
contentDescription.set(context.resources.getString(R.string.onboarding_slide_2_title))
title.set(context.resources.getString(R.string.onboarding_slide_2_title))
description.set(context.resources.getString(R.string.onboarding_slide_2_description))
}
ViewPagerSlide.SLIDE_3 -> {
- slideImage.set(R.drawable.ic_onboarding_3)
+ if (orientation == Configuration.ORIENTATION_LANDSCAPE){
+ slideImage.set(R.drawable.ic_landscape_onboarding_3)
+ } else if (orientation == Configuration.ORIENTATION_PORTRAIT){
+ slideImage.set(R.drawable.ic_onboarding_3)
+ }
contentDescription.set(context.resources.getString(R.string.onboarding_slide_3_title))
title.set(context.resources.getString(R.string.onboarding_slide_3_title))
description.set(context.resources.getString(R.string.onboarding_slide_3_description))
diff --git a/app/src/main/res/drawable/ic_landscape_onboarding_0.xml b/app/src/main/res/drawable/ic_landscape_onboarding_0.xml
new file mode 100644
index 00000000000..dd2d96655ed
--- /dev/null
+++ b/app/src/main/res/drawable/ic_landscape_onboarding_0.xml
@@ -0,0 +1,233 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_landscape_onboarding_1.xml b/app/src/main/res/drawable/ic_landscape_onboarding_1.xml
new file mode 100644
index 00000000000..62b6af2b47b
--- /dev/null
+++ b/app/src/main/res/drawable/ic_landscape_onboarding_1.xml
@@ -0,0 +1,143 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_landscape_onboarding_2.xml b/app/src/main/res/drawable/ic_landscape_onboarding_2.xml
new file mode 100644
index 00000000000..c0922d34fef
--- /dev/null
+++ b/app/src/main/res/drawable/ic_landscape_onboarding_2.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_landscape_onboarding_3.xml b/app/src/main/res/drawable/ic_landscape_onboarding_3.xml
new file mode 100644
index 00000000000..a3f6cf8d08c
--- /dev/null
+++ b/app/src/main/res/drawable/ic_landscape_onboarding_3.xml
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout-land/onboarding_fragment.xml b/app/src/main/res/layout-land/onboarding_fragment.xml
new file mode 100644
index 00000000000..4a380790b5a
--- /dev/null
+++ b/app/src/main/res/layout-land/onboarding_fragment.xml
@@ -0,0 +1,104 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout-land/onboarding_slide.xml b/app/src/main/res/layout-land/onboarding_slide.xml
new file mode 100644
index 00000000000..bc3cb3ed68e
--- /dev/null
+++ b/app/src/main/res/layout-land/onboarding_slide.xml
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/sharedTest/java/org/oppia/app/onboarding/OnboardingFragmentTest.kt b/app/src/sharedTest/java/org/oppia/app/onboarding/OnboardingFragmentTest.kt
index ba00e5c849b..26a0e173f3f 100644
--- a/app/src/sharedTest/java/org/oppia/app/onboarding/OnboardingFragmentTest.kt
+++ b/app/src/sharedTest/java/org/oppia/app/onboarding/OnboardingFragmentTest.kt
@@ -9,9 +9,11 @@ import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.contrib.ViewPagerActions.scrollToPage
import androidx.test.espresso.intent.Intents
import androidx.test.espresso.intent.Intents.intended
+import org.oppia.app.utility.OrientationChangeAction.Companion.orientationLandscape
import androidx.test.espresso.intent.matcher.IntentMatchers.hasComponent
import androidx.test.espresso.matcher.ViewMatchers.isCompletelyDisplayed
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
+import androidx.test.espresso.matcher.ViewMatchers.isRoot
import androidx.test.espresso.matcher.ViewMatchers.withAlpha
import androidx.test.espresso.matcher.ViewMatchers.withContentDescription
import androidx.test.espresso.matcher.ViewMatchers.withId
@@ -437,4 +439,45 @@ class OnboardingFragmentTest {
).check(matches(withText(R.string.onboarding_slide_3_title)))
}
}
+
+ @Test
+ fun testOnboardingFragment_slide0Title_changeOrientation_titleIsCorrect() {
+ launch(OnboardingActivity::class.java).use {
+ onView(isRoot()).perform(orientationLandscape())
+ onView(
+ allOf(
+ withId(R.id.slide_title_text_view),
+ isCompletelyDisplayed()
+ )
+ ).check(matches(withText(R.string.onboarding_slide_0_title)))
+ }
+ }
+
+ @Test
+ fun testOnboardingFragment_moveToSlide1_changeOrientation_titleIsCorrect() {
+ launch(OnboardingActivity::class.java).use {
+ onView(withId(R.id.onboarding_slide_view_pager)).perform(scrollToPage(1))
+ onView(isRoot()).perform(orientationLandscape())
+ onView(
+ allOf(
+ withId(R.id.slide_title_text_view),
+ isCompletelyDisplayed()
+ )
+ ).check(matches(withText(R.string.onboarding_slide_1_title)))
+ }
+ }
+
+ @Test
+ fun testOnboardingFragment_clickOnSkip_changeOrientation_titleIsCorrect() {
+ launch(OnboardingActivity::class.java).use {
+ onView(withId(R.id.skip_text_view)).perform(click())
+ onView(isRoot()).perform(orientationLandscape())
+ onView(
+ allOf(
+ withId(R.id.slide_title_text_view),
+ isCompletelyDisplayed()
+ )
+ ).check(matches(withText(R.string.onboarding_slide_3_title)))
+ }
+ }
}