diff --git a/app/src/main/java/org/oppia/android/app/onboarding/OnboardingFragment.kt b/app/src/main/java/org/oppia/android/app/onboarding/OnboardingFragment.kt index 081abae41ee..26949323a18 100644 --- a/app/src/main/java/org/oppia/android/app/onboarding/OnboardingFragment.kt +++ b/app/src/main/java/org/oppia/android/app/onboarding/OnboardingFragment.kt @@ -7,13 +7,23 @@ import android.view.View import android.view.ViewGroup import org.oppia.android.app.fragment.FragmentComponentImpl import org.oppia.android.app.fragment.InjectableFragment +import org.oppia.android.util.platformparameter.EnableOnboardingFlowV2 +import org.oppia.android.util.platformparameter.PlatformParameterValue import javax.inject.Inject +import org.oppia.android.app.onboardingv2.OnboardingFragmentPresenter as OnboardingFragmentPresenterV2 /** Fragment that contains an onboarding flow of the app. */ class OnboardingFragment : InjectableFragment() { @Inject lateinit var onboardingFragmentPresenter: OnboardingFragmentPresenter + @Inject + lateinit var onboardingFragmentPresenterV2: OnboardingFragmentPresenterV2 + + @Inject + @field:EnableOnboardingFlowV2 + lateinit var enableOnboardingFlowV2: PlatformParameterValue + override fun onAttach(context: Context) { super.onAttach(context) (fragmentComponent as FragmentComponentImpl).inject(this) @@ -24,6 +34,10 @@ class OnboardingFragment : InjectableFragment() { container: ViewGroup?, savedInstanceState: Bundle? ): View? { - return onboardingFragmentPresenter.handleCreateView(inflater, container) + return if (enableOnboardingFlowV2.value) { + onboardingFragmentPresenterV2.handleCreateView(inflater, container) + } else { + onboardingFragmentPresenter.handleCreateView(inflater, container) + } } } 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 new file mode 100644 index 00000000000..caa845c047b --- /dev/null +++ b/app/src/main/java/org/oppia/android/app/onboardingv2/OnboardingFragmentPresenter.kt @@ -0,0 +1,40 @@ +package org.oppia.android.app.onboardingv2 + +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.Fragment +import javax.inject.Inject +import org.oppia.android.R +import org.oppia.android.app.fragment.FragmentScope +import org.oppia.android.app.translation.AppLanguageResourceHandler +import org.oppia.android.databinding.OnboardingAppLanguageSelectionFragmentBinding + +/** The presenter for [OnboardingFragment] V2. */ +@FragmentScope +class OnboardingFragmentPresenter @Inject constructor( + private val fragment: Fragment, + private val appLanguageResourceHandler: AppLanguageResourceHandler +) { + private lateinit var binding: OnboardingAppLanguageSelectionFragmentBinding + + /** Handle creation and binding of the [OnboardingFragment] V2 layout. */ + fun handleCreateView(inflater: LayoutInflater, container: ViewGroup?): View { + binding = OnboardingAppLanguageSelectionFragmentBinding.inflate( + inflater, + container, + /* attachToRoot= */ false + ) + + binding.let { + it.lifecycleOwner = fragment + } + + binding.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/drawable/dropdown_background.xml b/app/src/main/res/drawable/dropdown_background.xml new file mode 100644 index 00000000000..3eca06cfe8c --- /dev/null +++ b/app/src/main/res/drawable/dropdown_background.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + 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 new file mode 100644 index 00000000000..f33dbad10d1 --- /dev/null +++ b/app/src/main/res/layout-land/onboarding_app_language_selection_fragment.xml @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +