-
Notifications
You must be signed in to change notification settings - Fork 527
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'new-onboarding-ui' into onboarding-profile-configuration
# Conflicts: # domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterAlphaKenyaModule.kt # domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterAlphaModule.kt # domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt # testing/src/main/java/org/oppia/android/testing/platformparameter/TestPlatformParameterModule.kt
- Loading branch information
Showing
46 changed files
with
1,282 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...rc/main/java/org/oppia/android/app/onboarding/onboardingv2/OnboardingFragmentPresenter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package org.oppia.android.app.onboarding.onboardingv2 | ||
|
||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import android.widget.ArrayAdapter | ||
import androidx.appcompat.app.AppCompatActivity | ||
import androidx.fragment.app.Fragment | ||
import org.oppia.android.R | ||
import org.oppia.android.app.fragment.FragmentScope | ||
import org.oppia.android.app.onboarding.OnboardingViewModel | ||
import org.oppia.android.app.viewmodel.ViewModelProvider | ||
import org.oppia.android.databinding.OnboardingAppLanguageSelectionFragmentBinding | ||
import javax.inject.Inject | ||
|
||
/** The presenter for [OnboardingFragment] V2. */ | ||
@FragmentScope | ||
class OnboardingFragmentPresenter @Inject constructor( | ||
private val activity: AppCompatActivity, | ||
private val fragment: Fragment, | ||
private val viewModelProvider: ViewModelProvider<OnboardingViewModel> | ||
) { | ||
private lateinit var binding: OnboardingAppLanguageSelectionFragmentBinding | ||
|
||
fun handleCreateView(inflater: LayoutInflater, container: ViewGroup?): View { | ||
binding = OnboardingAppLanguageSelectionFragmentBinding.inflate( | ||
inflater, | ||
container, | ||
/* attachToRoot= */ false | ||
) | ||
// NB: Both the view model and lifecycle owner must be set in order to correctly bind LiveData elements to | ||
// data-bound view models. | ||
binding.let { | ||
it.lifecycleOwner = fragment | ||
} | ||
|
||
binding.onboardingLanguageDropdown.adapter = ArrayAdapter( | ||
fragment.requireContext(), | ||
R.layout.onboarding_language_dropdown_item, | ||
R.id.onboarding_language_text_view, | ||
arrayOf("English") | ||
) | ||
|
||
binding.onboardingLanguageLetsGoButton.setOnClickListener { | ||
val intent = OnboardingProfileTypeActivity.createOnboardingProfileTypeActivityIntent(activity) | ||
fragment.startActivity(intent) | ||
} | ||
|
||
return binding.root | ||
} | ||
|
||
private fun getOnboardingViewModel(): OnboardingViewModel { | ||
return viewModelProvider.getForFragment(fragment, OnboardingViewModel::class.java) | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
.../main/java/org/oppia/android/app/onboarding/onboardingv2/OnboardingProfileTypeActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.oppia.android.app.onboarding.onboardingv2 | ||
|
||
import android.content.Context | ||
import android.content.Intent | ||
import android.os.Bundle | ||
import org.oppia.android.app.activity.ActivityComponentImpl | ||
import org.oppia.android.app.activity.InjectableAutoLocalizedAppCompatActivity | ||
import org.oppia.android.app.model.ScreenName | ||
import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.decorateWithScreenName | ||
import javax.inject.Inject | ||
|
||
/** The activity for showing the profile type selection screen. */ | ||
class OnboardingProfileTypeActivity : InjectableAutoLocalizedAppCompatActivity() { | ||
@Inject | ||
lateinit var onboardingProfileTypeActivityPresenter: OnboardingProfileTypeActivityPresenter | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
(activityComponent as ActivityComponentImpl).inject(this) | ||
|
||
onboardingProfileTypeActivityPresenter.handleOnCreate() | ||
} | ||
|
||
companion object { | ||
/** Returns a new [Intent] open a [OnboardingProfileTypeActivity] with the specified params. */ | ||
fun createOnboardingProfileTypeActivityIntent(context: Context): Intent { | ||
return Intent(context, OnboardingProfileTypeActivity::class.java).apply { | ||
decorateWithScreenName(ScreenName.ONBOARDING_PROFILE_TYPE_ACTIVITY) | ||
} | ||
} | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
...a/org/oppia/android/app/onboarding/onboardingv2/OnboardingProfileTypeActivityPresenter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package org.oppia.android.app.onboarding.onboardingv2 | ||
|
||
import androidx.appcompat.app.AppCompatActivity | ||
import androidx.databinding.DataBindingUtil | ||
import org.oppia.android.R | ||
import org.oppia.android.app.activity.ActivityScope | ||
import org.oppia.android.databinding.OnboardingProfileTypeActivityBinding | ||
import javax.inject.Inject | ||
|
||
private const val TAG_PROFILE_TYPE_FRAGMENT = "TAG_PROFILE_TYPE_FRAGMENT" | ||
|
||
/** The Presenter for [OnboardingProfileTypeActivity]. */ | ||
@ActivityScope | ||
class OnboardingProfileTypeActivityPresenter @Inject constructor( | ||
private val activity: AppCompatActivity | ||
) { | ||
private lateinit var binding: OnboardingProfileTypeActivityBinding | ||
|
||
/** Handle creation and binding of the OnboardingProfileTypeActivity layout. */ | ||
fun handleOnCreate() { | ||
binding = DataBindingUtil.setContentView(activity, R.layout.onboarding_profile_type_activity) | ||
binding.apply { | ||
lifecycleOwner = activity | ||
} | ||
|
||
if (getOnboardingProfileTypeFragment() == null) { | ||
val onboardingProfileTypeFragment = OnboardingProfileTypeFragment() | ||
activity.supportFragmentManager.beginTransaction().add( | ||
R.id.profile_type_fragment_placeholder, | ||
onboardingProfileTypeFragment, | ||
TAG_PROFILE_TYPE_FRAGMENT | ||
) | ||
.commitNow() | ||
} | ||
} | ||
|
||
private fun getOnboardingProfileTypeFragment(): OnboardingProfileTypeFragment? { | ||
return activity.supportFragmentManager.findFragmentByTag( | ||
TAG_PROFILE_TYPE_FRAGMENT | ||
) as? OnboardingProfileTypeFragment | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
.../main/java/org/oppia/android/app/onboarding/onboardingv2/OnboardingProfileTypeFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.oppia.android.app.onboarding.onboardingv2 | ||
|
||
import android.content.Context | ||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import org.oppia.android.app.fragment.FragmentComponentImpl | ||
import org.oppia.android.app.fragment.InjectableFragment | ||
import javax.inject.Inject | ||
|
||
/** Fragment that contains an onboarding flow of the app. */ | ||
class OnboardingProfileTypeFragment : InjectableFragment() { | ||
@Inject | ||
lateinit var onboardingProfileTypeFragmentPresenter: OnboardingProfileTypeFragmentPresenter | ||
|
||
override fun onAttach(context: Context) { | ||
super.onAttach(context) | ||
(fragmentComponent as FragmentComponentImpl).inject(this) | ||
} | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
return onboardingProfileTypeFragmentPresenter.handleCreateView(inflater, container) | ||
} | ||
} |
Oops, something went wrong.