diff --git a/app/src/main/java/org/oppia/android/app/activity/ActivityIntentFactories.kt b/app/src/main/java/org/oppia/android/app/activity/ActivityIntentFactories.kt index ab6ab90bf77..078032aabcf 100644 --- a/app/src/main/java/org/oppia/android/app/activity/ActivityIntentFactories.kt +++ b/app/src/main/java/org/oppia/android/app/activity/ActivityIntentFactories.kt @@ -16,15 +16,23 @@ interface ActivityIntentFactories { * This must be injected within an activity context. */ interface TopicActivityIntentFactory { - /** Returns a new [Intent] to start the topic activity for the specified profile and topic. */ - fun createIntent(profileId: ProfileId, topicId: String): Intent + /** + * Returns a new [Intent] to start the topic activity for the specified profile, classroom + * and topic. + */ + fun createIntent(profileId: ProfileId, classroomId: String, topicId: String): Intent /** - * Returns a new [Intent] to start the topic activity for the specified profile, topic, and - * story (where the activity will automatically navigate to & expand the specified story in the - * topic). + * Returns a new [Intent] to start the topic activity for the specified profile, classroom, + * topic, and story (where the activity will automatically navigate to & expand the specified + * story in the topic). */ - fun createIntent(profileId: ProfileId, topicId: String, storyId: String): Intent + fun createIntent( + profileId: ProfileId, + classroomId: String, + topicId: String, + storyId: String + ): Intent } /** diff --git a/app/src/main/java/org/oppia/android/app/classroom/ClassroomListActivity.kt b/app/src/main/java/org/oppia/android/app/classroom/ClassroomListActivity.kt index 4ba06da7d58..c8f075f10bf 100644 --- a/app/src/main/java/org/oppia/android/app/classroom/ClassroomListActivity.kt +++ b/app/src/main/java/org/oppia/android/app/classroom/ClassroomListActivity.kt @@ -19,7 +19,8 @@ import org.oppia.android.app.model.ProfileId import org.oppia.android.app.model.RecentlyPlayedActivityParams import org.oppia.android.app.model.RecentlyPlayedActivityTitle import org.oppia.android.app.model.ScreenName.CLASSROOM_LIST_ACTIVITY -import org.oppia.android.app.topic.TopicActivity +import org.oppia.android.app.topic.TopicActivity.Companion.createTopicActivityIntent +import org.oppia.android.app.topic.TopicActivity.Companion.createTopicPlayStoryActivityIntent import org.oppia.android.app.translation.AppLanguageResourceHandler import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.decorateWithScreenName import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.decorateWithUserProfileId @@ -98,15 +99,23 @@ class ClassroomListActivity : ) } - override fun routeToTopic(internalProfileId: Int, topicId: String) { - startActivity(TopicActivity.createTopicActivityIntent(this, internalProfileId, topicId)) + override fun routeToTopic(internalProfileId: Int, classroomId: String, topicId: String) { + startActivity( + createTopicActivityIntent(this, internalProfileId, classroomId, topicId) + ) } - override fun routeToTopicPlayStory(internalProfileId: Int, topicId: String, storyId: String) { + override fun routeToTopicPlayStory( + internalProfileId: Int, + classroomId: String, + topicId: String, + storyId: String + ) { startActivity( - TopicActivity.createTopicPlayStoryActivityIntent( + createTopicPlayStoryActivityIntent( this, internalProfileId, + classroomId, topicId, storyId ) diff --git a/app/src/main/java/org/oppia/android/app/classroom/ClassroomListFragmentPresenter.kt b/app/src/main/java/org/oppia/android/app/classroom/ClassroomListFragmentPresenter.kt index d92830046e5..0ce155bb93a 100644 --- a/app/src/main/java/org/oppia/android/app/classroom/ClassroomListFragmentPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/classroom/ClassroomListFragmentPresenter.kt @@ -28,6 +28,7 @@ import androidx.compose.ui.res.integerResource import androidx.compose.ui.unit.dp import androidx.databinding.ObservableList import androidx.fragment.app.Fragment +import androidx.lifecycle.Observer import org.oppia.android.R import org.oppia.android.app.classroom.classroomlist.AllClassroomsHeaderText import org.oppia.android.app.classroom.classroomlist.ClassroomList @@ -43,6 +44,7 @@ import org.oppia.android.app.home.classroomlist.ClassroomSummaryViewModel import org.oppia.android.app.home.promotedlist.PromotedStoryListViewModel import org.oppia.android.app.home.topiclist.AllTopicsViewModel import org.oppia.android.app.home.topiclist.TopicSummaryViewModel +import org.oppia.android.app.model.AppStartupState import org.oppia.android.app.model.ClassroomSummary import org.oppia.android.app.model.LessonThumbnail import org.oppia.android.app.model.LessonThumbnailGraphic @@ -51,10 +53,14 @@ import org.oppia.android.app.translation.AppLanguageResourceHandler import org.oppia.android.app.utility.datetime.DateTimeUtil import org.oppia.android.databinding.ClassroomListFragmentBinding import org.oppia.android.domain.classroom.ClassroomController +import org.oppia.android.domain.onboarding.AppStartupStateController import org.oppia.android.domain.oppialogger.OppiaLogger +import org.oppia.android.domain.oppialogger.analytics.AnalyticsController import org.oppia.android.domain.profile.ProfileManagementController import org.oppia.android.domain.topic.TopicListController import org.oppia.android.domain.translation.TranslationController +import org.oppia.android.util.data.AsyncResult +import org.oppia.android.util.data.DataProviders.Companion.toLiveData import org.oppia.android.util.locale.OppiaLocale import org.oppia.android.util.parser.html.StoryHtmlParserEntityType import org.oppia.android.util.parser.html.TopicHtmlParserEntityType @@ -78,6 +84,8 @@ class ClassroomListFragmentPresenter @Inject constructor( private val dateTimeUtil: DateTimeUtil, private val translationController: TranslationController, private val machineLocale: OppiaLocale.MachineLocale, + private val appStartupStateController: AppStartupStateController, + private val analyticsController: AnalyticsController, ) { private val routeToTopicPlayStoryListener = activity as RouteToTopicPlayStoryListener private lateinit var binding: ClassroomListFragmentBinding @@ -95,6 +103,8 @@ class ClassroomListFragmentPresenter @Inject constructor( internalProfileId = profileId.internalId + logHomeActivityEvent() + classroomListViewModel = ClassroomListViewModel( activity, fragment, @@ -147,6 +157,8 @@ class ClassroomListFragmentPresenter @Inject constructor( } ) + logAppOnboardedEvent() + return binding.root } @@ -154,6 +166,7 @@ class ClassroomListFragmentPresenter @Inject constructor( fun onTopicSummaryClicked(topicSummary: TopicSummary) { routeToTopicPlayStoryListener.routeToTopicPlayStory( internalProfileId, + topicSummary.classroomId, topicSummary.topicId, topicSummary.firstStoryId ) @@ -237,6 +250,45 @@ class ClassroomListFragmentPresenter @Inject constructor( } } } + + private fun logAppOnboardedEvent() { + val startupStateProvider = appStartupStateController.getAppStartupState() + val liveData = startupStateProvider.toLiveData() + liveData.observe( + activity, + object : Observer> { + override fun onChanged(startUpStateResult: AsyncResult?) { + when (startUpStateResult) { + null, is AsyncResult.Pending -> { + // Do nothing. + } + is AsyncResult.Success -> { + liveData.removeObserver(this) + + if (startUpStateResult.value.startupMode == + AppStartupState.StartupMode.USER_NOT_YET_ONBOARDED + ) { + analyticsController.logAppOnboardedEvent(profileId) + } + } + is AsyncResult.Failure -> { + oppiaLogger.e( + "ClassroomListFragment", + "Failed to retrieve app startup state" + ) + } + } + } + } + ) + } + + private fun logHomeActivityEvent() { + analyticsController.logImportantEvent( + oppiaLogger.createOpenHomeContext(), + profileId + ) + } } /** Adds a grid of items to a LazyListScope with specified arrangement and item content. */ diff --git a/app/src/main/java/org/oppia/android/app/completedstorylist/CompletedStoryItemViewModel.kt b/app/src/main/java/org/oppia/android/app/completedstorylist/CompletedStoryItemViewModel.kt index 355389d59b5..6e8507554c0 100644 --- a/app/src/main/java/org/oppia/android/app/completedstorylist/CompletedStoryItemViewModel.kt +++ b/app/src/main/java/org/oppia/android/app/completedstorylist/CompletedStoryItemViewModel.kt @@ -31,13 +31,24 @@ class CompletedStoryItemViewModel( /** Called when user clicks on CompletedStoryItem. */ fun onCompletedStoryItemClicked() { - routeToTopicPlayStory(internalProfileId, completedStory.topicId, completedStory.storyId) + routeToTopicPlayStory( + internalProfileId, + completedStory.classroomId, + completedStory.topicId, + completedStory.storyId + ) } - override fun routeToTopicPlayStory(internalProfileId: Int, topicId: String, storyId: String) { + override fun routeToTopicPlayStory( + internalProfileId: Int, + classroomId: String, + topicId: String, + storyId: String + ) { val intent = intentFactoryShim.createTopicPlayStoryActivityIntent( activity.applicationContext, internalProfileId, + classroomId, topicId, storyId ) diff --git a/app/src/main/java/org/oppia/android/app/home/HomeActivity.kt b/app/src/main/java/org/oppia/android/app/home/HomeActivity.kt index 8d6f828abd0..34885717a33 100644 --- a/app/src/main/java/org/oppia/android/app/home/HomeActivity.kt +++ b/app/src/main/java/org/oppia/android/app/home/HomeActivity.kt @@ -67,8 +67,10 @@ class HomeActivity : homeActivityPresenter.handleOnRestart() } - override fun routeToTopic(internalProfileId: Int, topicId: String) { - startActivity(TopicActivity.createTopicActivityIntent(this, internalProfileId, topicId)) + override fun routeToTopic(internalProfileId: Int, classroomId: String, topicId: String) { + startActivity( + TopicActivity.createTopicActivityIntent(this, internalProfileId, classroomId, topicId) + ) } override fun onBackPressed() { @@ -87,11 +89,17 @@ class HomeActivity : dialogFragment.showNow(supportFragmentManager, TAG_SWITCH_PROFILE_DIALOG) } - override fun routeToTopicPlayStory(internalProfileId: Int, topicId: String, storyId: String) { + override fun routeToTopicPlayStory( + internalProfileId: Int, + classroomId: String, + topicId: String, + storyId: String + ) { startActivity( TopicActivity.createTopicPlayStoryActivityIntent( this, internalProfileId, + classroomId, topicId, storyId ) diff --git a/app/src/main/java/org/oppia/android/app/home/HomeFragmentPresenter.kt b/app/src/main/java/org/oppia/android/app/home/HomeFragmentPresenter.kt index 64d53c68009..b3ef5d04e3f 100644 --- a/app/src/main/java/org/oppia/android/app/home/HomeFragmentPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/home/HomeFragmentPresenter.kt @@ -197,6 +197,7 @@ class HomeFragmentPresenter @Inject constructor( fun onTopicSummaryClicked(topicSummary: TopicSummary) { routeToTopicPlayStoryListener.routeToTopicPlayStory( internalProfileId, + topicSummary.classroomId, topicSummary.topicId, topicSummary.firstStoryId ) diff --git a/app/src/main/java/org/oppia/android/app/home/RouteToExplorationListener.kt b/app/src/main/java/org/oppia/android/app/home/RouteToExplorationListener.kt index 3c8081a3152..9523938373d 100755 --- a/app/src/main/java/org/oppia/android/app/home/RouteToExplorationListener.kt +++ b/app/src/main/java/org/oppia/android/app/home/RouteToExplorationListener.kt @@ -7,6 +7,7 @@ import org.oppia.android.app.model.ProfileId interface RouteToExplorationListener { fun routeToExploration( profileId: ProfileId, + classroomId: String, topicId: String, storyId: String, explorationId: String, diff --git a/app/src/main/java/org/oppia/android/app/home/RouteToTopicListener.kt b/app/src/main/java/org/oppia/android/app/home/RouteToTopicListener.kt index 36c7a1a1d94..c00a7dc8389 100755 --- a/app/src/main/java/org/oppia/android/app/home/RouteToTopicListener.kt +++ b/app/src/main/java/org/oppia/android/app/home/RouteToTopicListener.kt @@ -2,5 +2,5 @@ package org.oppia.android.app.home /** Listener for when an activity should route to a topic. */ interface RouteToTopicListener { - fun routeToTopic(internalProfileId: Int, topicId: String) + fun routeToTopic(internalProfileId: Int, classroomId: String, topicId: String) } diff --git a/app/src/main/java/org/oppia/android/app/home/RouteToTopicPlayStoryListener.kt b/app/src/main/java/org/oppia/android/app/home/RouteToTopicPlayStoryListener.kt index aa7121f1c07..4d45619ede8 100755 --- a/app/src/main/java/org/oppia/android/app/home/RouteToTopicPlayStoryListener.kt +++ b/app/src/main/java/org/oppia/android/app/home/RouteToTopicPlayStoryListener.kt @@ -2,5 +2,10 @@ package org.oppia.android.app.home /** Listener for when an activity should route to a story-item in TopicPlay tab. */ interface RouteToTopicPlayStoryListener { - fun routeToTopicPlayStory(internalProfileId: Int, topicId: String, storyId: String) + fun routeToTopicPlayStory( + internalProfileId: Int, + classroomId: String, + topicId: String, + storyId: String + ) } diff --git a/app/src/main/java/org/oppia/android/app/home/promotedlist/PromotedStoryViewModel.kt b/app/src/main/java/org/oppia/android/app/home/promotedlist/PromotedStoryViewModel.kt index 6b300f6355d..dae19f0866e 100755 --- a/app/src/main/java/org/oppia/android/app/home/promotedlist/PromotedStoryViewModel.kt +++ b/app/src/main/java/org/oppia/android/app/home/promotedlist/PromotedStoryViewModel.kt @@ -63,6 +63,7 @@ class PromotedStoryViewModel( fun clickOnStoryTile() { routeToTopicPlayStoryListener.routeToTopicPlayStory( internalProfileId, + promotedStory.classroomId, promotedStory.topicId, promotedStory.storyId ) diff --git a/app/src/main/java/org/oppia/android/app/home/recentlyplayed/RecentlyPlayedActivity.kt b/app/src/main/java/org/oppia/android/app/home/recentlyplayed/RecentlyPlayedActivity.kt index bf852642259..3450d510fbe 100644 --- a/app/src/main/java/org/oppia/android/app/home/recentlyplayed/RecentlyPlayedActivity.kt +++ b/app/src/main/java/org/oppia/android/app/home/recentlyplayed/RecentlyPlayedActivity.kt @@ -62,6 +62,7 @@ class RecentlyPlayedActivity : override fun routeToExploration( profileId: ProfileId, + classroomId: String, topicId: String, storyId: String, explorationId: String, @@ -72,6 +73,7 @@ class RecentlyPlayedActivity : ExplorationActivity.createExplorationActivityIntent( this, profileId, + classroomId, topicId, storyId, explorationId, @@ -83,6 +85,7 @@ class RecentlyPlayedActivity : override fun routeToResumeLesson( profileId: ProfileId, + classroomId: String, topicId: String, storyId: String, explorationId: String, @@ -93,6 +96,7 @@ class RecentlyPlayedActivity : ResumeLessonActivity.createResumeLessonActivityIntent( this, profileId, + classroomId, topicId, storyId, explorationId, diff --git a/app/src/main/java/org/oppia/android/app/home/recentlyplayed/RecentlyPlayedFragmentPresenter.kt b/app/src/main/java/org/oppia/android/app/home/recentlyplayed/RecentlyPlayedFragmentPresenter.kt index fcd8a8b3c7c..98b7617e0eb 100755 --- a/app/src/main/java/org/oppia/android/app/home/recentlyplayed/RecentlyPlayedFragmentPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/home/recentlyplayed/RecentlyPlayedFragmentPresenter.kt @@ -108,6 +108,7 @@ class RecentlyPlayedFragmentPresenter @Inject constructor( explorationCheckpointLiveData.removeObserver(this) routeToResumeLessonListener.routeToResumeLesson( profileId, + promotedStory.classroomId, promotedStory.topicId, promotedStory.storyId, promotedStory.explorationId, @@ -117,6 +118,7 @@ class RecentlyPlayedFragmentPresenter @Inject constructor( } else if (it is AsyncResult.Failure) { explorationCheckpointLiveData.removeObserver(this) playExploration( + promotedStory.classroomId, promotedStory.topicId, promotedStory.storyId, promotedStory.explorationId, @@ -128,6 +130,7 @@ class RecentlyPlayedFragmentPresenter @Inject constructor( ) } else { playExploration( + promotedStory.classroomId, promotedStory.topicId, promotedStory.storyId, promotedStory.explorationId, @@ -162,6 +165,7 @@ class RecentlyPlayedFragmentPresenter @Inject constructor( } private fun playExploration( + classroomId: String, topicId: String, storyId: String, explorationId: String, @@ -174,13 +178,13 @@ class RecentlyPlayedFragmentPresenter @Inject constructor( // cases, lessons played from this fragment are known to be in progress, and that progress // can't be resumed here (hence the restart). explorationDataController.restartExploration( - profileId.internalId, topicId, storyId, explorationId + profileId.internalId, classroomId, topicId, storyId, explorationId ) } else { // The only lessons that can't have their progress saved are those that were already // completed. explorationDataController.replayExploration( - profileId.internalId, topicId, storyId, explorationId + profileId.internalId, classroomId, topicId, storyId, explorationId ) } startPlayingProvider.toLiveData().observe(fragment) { result -> @@ -192,6 +196,7 @@ class RecentlyPlayedFragmentPresenter @Inject constructor( oppiaLogger.d("RecentlyPlayedFragment", "Successfully loaded exploration") routeToExplorationListener.routeToExploration( profileId, + classroomId, topicId, storyId, explorationId, diff --git a/app/src/main/java/org/oppia/android/app/ongoingtopiclist/OngoingTopicItemViewModel.kt b/app/src/main/java/org/oppia/android/app/ongoingtopiclist/OngoingTopicItemViewModel.kt index 2f8e6f9e84d..1b074ed6f1b 100644 --- a/app/src/main/java/org/oppia/android/app/ongoingtopiclist/OngoingTopicItemViewModel.kt +++ b/app/src/main/java/org/oppia/android/app/ongoingtopiclist/OngoingTopicItemViewModel.kt @@ -27,7 +27,7 @@ class OngoingTopicItemViewModel( } fun onTopicItemClicked() { - routeToTopic(internalProfileId, topic.topicId) + routeToTopic(internalProfileId, topic.classroomId, topic.topicId) } fun computeStoryCountText(): String { @@ -36,10 +36,11 @@ class OngoingTopicItemViewModel( ) } - override fun routeToTopic(internalProfileId: Int, topicId: String) { + override fun routeToTopic(internalProfileId: Int, classroomId: String, topicId: String) { val intent = intentFactoryShim.createTopicActivityIntent( activity.applicationContext, internalProfileId, + classroomId, topicId ) activity.startActivity(intent) diff --git a/app/src/main/java/org/oppia/android/app/player/exploration/ExplorationActivity.kt b/app/src/main/java/org/oppia/android/app/player/exploration/ExplorationActivity.kt index 4e73ac992e3..b95785bf2d0 100755 --- a/app/src/main/java/org/oppia/android/app/player/exploration/ExplorationActivity.kt +++ b/app/src/main/java/org/oppia/android/app/player/exploration/ExplorationActivity.kt @@ -60,6 +60,7 @@ class ExplorationActivity : explorationActivityPresenter.handleOnCreate( this, params.profileId, + params.classroomId, params.topicId, params.storyId, params.explorationId, @@ -79,6 +80,7 @@ class ExplorationActivity : fun createExplorationActivityIntent( context: Context, profileId: ProfileId, + classroomId: String, topicId: String, storyId: String, explorationId: String, @@ -87,6 +89,7 @@ class ExplorationActivity : ): Intent { val params = ExplorationActivityParams.newBuilder().apply { this.profileId = profileId + this.classroomId = classroomId this.topicId = topicId this.storyId = storyId this.explorationId = explorationId diff --git a/app/src/main/java/org/oppia/android/app/player/exploration/ExplorationActivityPresenter.kt b/app/src/main/java/org/oppia/android/app/player/exploration/ExplorationActivityPresenter.kt index 76812ff7522..9d1c50ec2ea 100644 --- a/app/src/main/java/org/oppia/android/app/player/exploration/ExplorationActivityPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/player/exploration/ExplorationActivityPresenter.kt @@ -70,6 +70,7 @@ class ExplorationActivityPresenter @Inject constructor( private lateinit var explorationToolbar: Toolbar private lateinit var explorationToolbarTitle: TextView private lateinit var profileId: ProfileId + private lateinit var classroomId: String private lateinit var topicId: String private lateinit var storyId: String private lateinit var explorationId: String @@ -85,6 +86,7 @@ class ExplorationActivityPresenter @Inject constructor( fun handleOnCreate( context: Context, profileId: ProfileId, + classroomId: String, topicId: String, storyId: String, explorationId: String, @@ -125,6 +127,7 @@ class ExplorationActivityPresenter @Inject constructor( } this.profileId = profileId + this.classroomId = classroomId this.topicId = topicId this.storyId = storyId this.explorationId = explorationId @@ -187,6 +190,7 @@ class ExplorationActivityPresenter @Inject constructor( R.id.exploration_fragment_placeholder, ExplorationFragment.newInstance( profileId, + classroomId, topicId, storyId, explorationId, @@ -386,7 +390,12 @@ class ExplorationActivityPresenter @Inject constructor( ExplorationActivityParams.ParentScreen.UNRECOGNIZED -> { // Default to the topic activity. activity.startActivity( - TopicActivity.createTopicActivityIntent(context, profileId.internalId, topicId) + TopicActivity.createTopicActivityIntent( + context, + profileId.internalId, + classroomId, + topicId + ) ) activity.finish() } diff --git a/app/src/main/java/org/oppia/android/app/player/exploration/ExplorationFragment.kt b/app/src/main/java/org/oppia/android/app/player/exploration/ExplorationFragment.kt index 8411ab49c46..fdffb73b32d 100755 --- a/app/src/main/java/org/oppia/android/app/player/exploration/ExplorationFragment.kt +++ b/app/src/main/java/org/oppia/android/app/player/exploration/ExplorationFragment.kt @@ -22,6 +22,7 @@ class ExplorationFragment : InjectableFragment() { /** Returns a new [ExplorationFragment] with the corresponding fragment parameters. */ fun newInstance( profileId: ProfileId, + classroomId: String, topicId: String, storyId: String, explorationId: String, @@ -29,6 +30,7 @@ class ExplorationFragment : InjectableFragment() { ): ExplorationFragment { val args = ExplorationFragmentArguments.newBuilder().apply { this.profileId = profileId + this.classroomId = classroomId this.topicId = topicId this.storyId = storyId this.explorationId = explorationId diff --git a/app/src/main/java/org/oppia/android/app/player/exploration/ExplorationFragmentPresenter.kt b/app/src/main/java/org/oppia/android/app/player/exploration/ExplorationFragmentPresenter.kt index a64fa466a65..151f2456f53 100755 --- a/app/src/main/java/org/oppia/android/app/player/exploration/ExplorationFragmentPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/player/exploration/ExplorationFragmentPresenter.kt @@ -58,7 +58,7 @@ class ExplorationFragmentPresenter @Inject constructor( StateFragment.newInstance( args.profileId.internalId, args.topicId, args.storyId, args.explorationId ) - logPracticeFragmentEvent(args.topicId, args.storyId, args.explorationId) + logPracticeFragmentEvent(args.classroomId, args.topicId, args.storyId, args.explorationId) if (getStateFragment() == null) { fragment.childFragmentManager.beginTransaction().add( R.id.state_fragment_placeholder, @@ -153,9 +153,16 @@ class ExplorationFragmentPresenter @Inject constructor( ) as StateFragment? } - private fun logPracticeFragmentEvent(topicId: String, storyId: String, explorationId: String) { + private fun logPracticeFragmentEvent( + classroomId: String, + topicId: String, + storyId: String, + explorationId: String + ) { analyticsController.logImportantEvent( - oppiaLogger.createOpenExplorationActivityContext(topicId, storyId, explorationId), + oppiaLogger.createOpenExplorationActivityContext( + classroomId, topicId, storyId, explorationId + ), ProfileId.newBuilder().apply { internalId = internalProfileId }.build() ) } diff --git a/app/src/main/java/org/oppia/android/app/player/state/StateFragmentPresenter.kt b/app/src/main/java/org/oppia/android/app/player/state/StateFragmentPresenter.kt index a6726774c96..e939d9afbb4 100755 --- a/app/src/main/java/org/oppia/android/app/player/state/StateFragmentPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/player/state/StateFragmentPresenter.kt @@ -438,9 +438,8 @@ class StateFragmentPresenter @Inject constructor( val inputManager: InputMethodManager = activity.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager inputManager.hideSoftInputFromWindow( - fragment.view!!.windowToken, - @Suppress("DEPRECATION") // TODO(#5406): Use the correct constant value here. - InputMethodManager.SHOW_FORCED + fragment.requireView().windowToken, + 0 // Flag value to force hide the keyboard when possible. ) } diff --git a/app/src/main/java/org/oppia/android/app/player/state/testing/StateFragmentTestActivity.kt b/app/src/main/java/org/oppia/android/app/player/state/testing/StateFragmentTestActivity.kt index e8117516284..2fc44ad11f5 100644 --- a/app/src/main/java/org/oppia/android/app/player/state/testing/StateFragmentTestActivity.kt +++ b/app/src/main/java/org/oppia/android/app/player/state/testing/StateFragmentTestActivity.kt @@ -71,6 +71,7 @@ class StateFragmentTestActivity : fun createTestActivityIntent( context: Context, profileId: Int, + classroomId: String, topicId: String, storyId: String, explorationId: String, @@ -78,6 +79,7 @@ class StateFragmentTestActivity : ): Intent { val args = StateFragmentTestActivityParams.newBuilder().apply { this.internalProfileId = profileId + this.classroomId = classroomId this.topicId = topicId this.storyId = storyId this.explorationId = explorationId diff --git a/app/src/main/java/org/oppia/android/app/player/state/testing/StateFragmentTestActivityPresenter.kt b/app/src/main/java/org/oppia/android/app/player/state/testing/StateFragmentTestActivityPresenter.kt index 3c52bb6e777..6beed9aaf21 100644 --- a/app/src/main/java/org/oppia/android/app/player/state/testing/StateFragmentTestActivityPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/player/state/testing/StateFragmentTestActivityPresenter.kt @@ -12,6 +12,7 @@ import org.oppia.android.app.player.exploration.TAG_HINTS_AND_SOLUTION_EXPLORATI import org.oppia.android.app.player.state.StateFragment import org.oppia.android.app.player.state.testing.StateFragmentTestActivity.Companion.STATE_FRAGMENT_TEST_ACTIVITY_PARAMS_KEY import org.oppia.android.databinding.StateFragmentTestActivityBinding +import org.oppia.android.domain.classroom.TEST_CLASSROOM_ID_0 import org.oppia.android.domain.exploration.ExplorationDataController import org.oppia.android.domain.oppialogger.OppiaLogger import org.oppia.android.domain.topic.TEST_EXPLORATION_ID_2 @@ -34,6 +35,7 @@ class StateFragmentTestActivityPresenter @Inject constructor( ) { private var profileId: Int = 1 + private lateinit var classroomId: String private lateinit var topicId: String private lateinit var storyId: String private lateinit var explorationId: String @@ -54,6 +56,7 @@ class StateFragmentTestActivityPresenter @Inject constructor( StateFragmentTestActivityParams.getDefaultInstance() ) profileId = args?.internalProfileId ?: 1 + classroomId = args?.classroomId ?: TEST_CLASSROOM_ID_0 topicId = args?.topicId ?: TEST_TOPIC_ID_0 storyId = @@ -63,7 +66,14 @@ class StateFragmentTestActivityPresenter @Inject constructor( ?: TEST_EXPLORATION_ID_2 shouldSavePartialProgress = args?.shouldSavePartialProgress ?: false activity.findViewById