diff --git a/app/BUILD.bazel b/app/BUILD.bazel index 3959344ac4b..a664895c6fe 100644 --- a/app/BUILD.bazel +++ b/app/BUILD.bazel @@ -53,8 +53,8 @@ VIEW_MODEL_FILES = [ "src/main/java/org/oppia/app/options/OptionsAudioLanguageViewModel.kt", "src/main/java/org/oppia/app/options/OptionsItemViewModel.kt", "src/main/java/org/oppia/app/options/OptionsStoryTextViewViewModel.kt", - "src/main/java/org/oppia/app/parser/StringToFractionParser.kt", - "src/main/java/org/oppia/app/parser/StringToNumberParser.kt", + "update_src/main/java/org/oppia/app/parser/StringToFractionParser", + "update_src/main/java/org/oppia/app/parser/StringToNumberParser", "src/main/java/org/oppia/app/player/audio/AudioViewModel.kt", "src/main/java/org/oppia/app/player/exploration/ExplorationViewModel.kt", "src/main/java/org/oppia/app/player/state/itemviewmodel/ContentViewModel.kt", @@ -142,6 +142,8 @@ ALTERED_VIEW_MODELS = [ "src/main/java/org/oppia/app/onboarding/OnboardingViewModel.kt", "src/main/java/org/oppia/app/help/faq/FAQListViewModel.kt", "src/main/java/org/oppia/app/administratorcontrols/administratorcontrolsitemviewmodel/AdministratorControlsAccountActionsViewModel.kt", + "src/main/java/org/oppia/app/parser/StringToNumberParser.kt", + "src/main/java/org/oppia/app/parser/StringToFractionParser.kt", ] genrule( @@ -234,6 +236,26 @@ genrule( ''', ) +genrule( + name = "update_src/main/java/org/oppia/app/parser/StringToNumberParser", + srcs = ["src/main/java/org/oppia/app/parser/StringToNumberParser.kt"], + outs = ["src/main/java/org/oppia/app/parser/StringToNumberParser_updated.kt"], + cmd = ''' + cat $(SRCS) | + sed 's/import org.oppia.app.R/import org.oppia.app.vm.R/g' > $(OUTS) + ''', +) + +genrule( + name = "update_src/main/java/org/oppia/app/parser/StringToFractionParser", + srcs = ["src/main/java/org/oppia/app/parser/StringToFractionParser.kt"], + outs = ["src/main/java/org/oppia/app/parser/StringToFractionParser_updated.kt"], + cmd = ''' + cat $(SRCS) | + sed 's/import org.oppia.app.R/import org.oppia.app.vm.R/g' > $(OUTS) + ''', +) + LISTENER_FILES = [ "src/main/java/org/oppia/app/home/topiclist/TopicSummaryClickListener.kt", "src/main/java/org/oppia/app/administratorcontrols/RouteToAppVersionListener.kt", @@ -311,7 +333,7 @@ genrule( outs = ["src/main/java/org/oppia/app/customview/LessonThumbnailImageView_updated.kt"], cmd = ''' cat $(SRCS) | - sed 's/import org.oppia.app.R/import org.oppia.app.vm.R/g' > $(OUTS) + sed 's/import org.oppia.app.R/import org.oppia.app.views.R/g' > $(OUTS) ''', ) @@ -321,7 +343,7 @@ genrule( outs = ["src/main/java/org/oppia/app/customview/SegmentedCircularProgressView_updated.kt"], cmd = ''' cat $(SRCS) | - sed 's/import org.oppia.app.R/import org.oppia.app.vm.R/g' > $(OUTS) + sed 's/import org.oppia.app.R/import org.oppia.app.views.R/g' > $(OUTS) ''', ) @@ -331,7 +353,7 @@ genrule( outs = ["src/main/java/org/oppia/app/profile/ProfileInputView_updated.kt"], cmd = ''' cat $(SRCS) | - sed 's/import org.oppia.app.R/import org.oppia.app.vm.R/g' > $(OUTS) + sed 's/import org.oppia.app.R/import org.oppia.app.views.R/g' > $(OUTS) ''', ) genrule( @@ -340,7 +362,7 @@ genrule( outs = ["src/main/java/org/oppia/app/utility/ClickableAreasImage_updated.kt"], cmd = ''' cat $(SRCS) | - sed 's/import org.oppia.app.R/import org.oppia.app.vm.R/g' > $(OUTS) + sed 's/import org.oppia.app.R/import org.oppia.app.views.R/g' > $(OUTS) ''', ) diff --git a/app/src/main/java/org/oppia/app/application/ApplicationComponent.kt b/app/src/main/java/org/oppia/app/application/ApplicationComponent.kt index c7552b19688..3e60b7c19bf 100644 --- a/app/src/main/java/org/oppia/app/application/ApplicationComponent.kt +++ b/app/src/main/java/org/oppia/app/application/ApplicationComponent.kt @@ -4,6 +4,8 @@ import android.app.Application import dagger.BindsInstance import dagger.Component import org.oppia.app.activity.ActivityComponent +import org.oppia.app.shim.IntentFactoryShimModule +import org.oppia.app.shim.ViewBindingShimModule import org.oppia.data.backends.gae.NetworkModule import org.oppia.domain.classify.InteractionsModule import org.oppia.domain.classify.rules.continueinteraction.ContinueModule diff --git a/app/src/main/java/org/oppia/app/home/HomeFragmentPresenter.kt b/app/src/main/java/org/oppia/app/home/HomeFragmentPresenter.kt index 04724cc9c33..c74eecdee00 100644 --- a/app/src/main/java/org/oppia/app/home/HomeFragmentPresenter.kt +++ b/app/src/main/java/org/oppia/app/home/HomeFragmentPresenter.kt @@ -25,6 +25,7 @@ import org.oppia.app.model.Profile import org.oppia.app.model.ProfileId import org.oppia.app.model.TopicList import org.oppia.app.model.TopicSummary +import org.oppia.app.shim.IntentFactoryShimInterface import org.oppia.domain.oppialogger.OppiaLogger import org.oppia.domain.profile.ProfileManagementController import org.oppia.domain.topic.TopicListController @@ -46,6 +47,7 @@ class HomeFragmentPresenter @Inject constructor( private val oppiaClock: OppiaClock, private val logger: ConsoleLogger, private val oppiaLogger: OppiaLogger, + private val intentFactoryShimInterface: IntentFactoryShimInterface, @TopicHtmlParserEntityType private val topicEntityType: String, @StoryHtmlParserEntityType private val storyEntityType: String ) { @@ -71,7 +73,11 @@ class HomeFragmentPresenter @Inject constructor( logHomeActivityEvent() welcomeViewModel = WelcomeViewModel() - promotedStoryListViewModel = PromotedStoryListViewModel(activity, internalProfileId) + promotedStoryListViewModel = PromotedStoryListViewModel( + activity, + internalProfileId, + intentFactoryShimInterface + ) allTopicsViewModel = AllTopicsViewModel() itemList.add(welcomeViewModel) itemList.add(promotedStoryListViewModel) @@ -191,14 +197,24 @@ class HomeFragmentPresenter @Inject constructor( promotedStoryList.clear() if (it.recentStoryCount != 0) { it.recentStoryList.take(limit).forEach { promotedStory -> - val recentStory = PromotedStoryViewModel(activity, internalProfileId, storyEntityType) + val recentStory = PromotedStoryViewModel( + activity, + internalProfileId, + storyEntityType, + intentFactoryShimInterface + ) recentStory.setPromotedStory(promotedStory) promotedStoryList.add(recentStory) } } else { // TODO(#936): Optimise this as part of recommended stories. it.olderStoryList.take(limit).forEach { promotedStory -> - val oldStory = PromotedStoryViewModel(activity, internalProfileId, storyEntityType) + val oldStory = PromotedStoryViewModel( + activity, + internalProfileId, + storyEntityType, + intentFactoryShimInterface + ) oldStory.setPromotedStory(promotedStory) promotedStoryList.add(oldStory) } diff --git a/app/src/main/java/org/oppia/app/parser/StringToFractionParser.kt b/app/src/main/java/org/oppia/app/parser/StringToFractionParser.kt index c57c02310da..e35020ee950 100644 --- a/app/src/main/java/org/oppia/app/parser/StringToFractionParser.kt +++ b/app/src/main/java/org/oppia/app/parser/StringToFractionParser.kt @@ -3,7 +3,7 @@ package org.oppia.app.parser import android.content.Context import androidx.annotation.StringRes import org.oppia.app.model.Fraction -import org.oppia.app.vm.R +import org.oppia.app.R import org.oppia.domain.util.normalizeWhitespace /** This class contains method that helps to parse string to fraction. */ diff --git a/app/src/main/java/org/oppia/app/parser/StringToNumberParser.kt b/app/src/main/java/org/oppia/app/parser/StringToNumberParser.kt index 4e255cb70a8..ae51f4d21be 100644 --- a/app/src/main/java/org/oppia/app/parser/StringToNumberParser.kt +++ b/app/src/main/java/org/oppia/app/parser/StringToNumberParser.kt @@ -2,7 +2,7 @@ package org.oppia.app.parser import android.content.Context import androidx.annotation.StringRes -import org.oppia.app.vm.R +import org.oppia.app.R import org.oppia.domain.util.normalizeWhitespace /** This class contains methods that help to parse string to number, check realtime and submit time errors. */ diff --git a/app/src/main/java/org/oppia/app/player/state/StateFragmentPresenter.kt b/app/src/main/java/org/oppia/app/player/state/StateFragmentPresenter.kt index 5cf395bfa14..ab8c05bf72b 100755 --- a/app/src/main/java/org/oppia/app/player/state/StateFragmentPresenter.kt +++ b/app/src/main/java/org/oppia/app/player/state/StateFragmentPresenter.kt @@ -13,7 +13,7 @@ import androidx.lifecycle.Observer import androidx.lifecycle.Transformations import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView -import org.oppia.app.databinding.databinding.StateFragmentBinding +import org.oppia.app.databinding.StateFragmentBinding import org.oppia.app.fragment.FragmentScope import org.oppia.app.model.AnswerOutcome import org.oppia.app.model.EphemeralState @@ -28,7 +28,7 @@ import org.oppia.app.player.audio.AudioFragment import org.oppia.app.player.audio.AudioUiManager import org.oppia.app.player.state.listener.RouteToHintsAndSolutionListener import org.oppia.app.player.stopplaying.StopStatePlayingSessionListener -import org.oppia.app.ui.R +import org.oppia.app.R import org.oppia.app.utility.LifecycleSafeTimerFactory import org.oppia.app.utility.SplitScreenManager import org.oppia.app.viewmodel.ViewModelProvider diff --git a/app/src/main/java/org/oppia/app/topic/conceptcard/ConceptCardFragmentPresenter.kt b/app/src/main/java/org/oppia/app/topic/conceptcard/ConceptCardFragmentPresenter.kt index dfe6da2bb42..1078ae4763a 100644 --- a/app/src/main/java/org/oppia/app/topic/conceptcard/ConceptCardFragmentPresenter.kt +++ b/app/src/main/java/org/oppia/app/topic/conceptcard/ConceptCardFragmentPresenter.kt @@ -33,10 +33,11 @@ class ConceptCardFragmentPresenter @Inject constructor( container, /* attachToRoot= */ false ) + val view = binding.conceptCardExplanationText val viewModel = getConceptCardViewModel() skillId = id - viewModel.setSkillIdAndBinding(skillId, binding) + viewModel.setSkillIdAndBinding(skillId, view) logConceptCardEvent(skillId) binding.conceptCardToolbar.setNavigationIcon(R.drawable.ic_close_white_24dp) diff --git a/app/src/main/java/org/oppia/app/topic/revisioncard/RevisionCardFragmentPresenter.kt b/app/src/main/java/org/oppia/app/topic/revisioncard/RevisionCardFragmentPresenter.kt index 14da3f71517..e9629aa4f14 100755 --- a/app/src/main/java/org/oppia/app/topic/revisioncard/RevisionCardFragmentPresenter.kt +++ b/app/src/main/java/org/oppia/app/topic/revisioncard/RevisionCardFragmentPresenter.kt @@ -33,9 +33,10 @@ class RevisionCardFragmentPresenter @Inject constructor( container, /* attachToRoot= */ false ) + val view = binding.revisionCardExplanationText; val viewModel = getReviewCardViewModel() - viewModel.setSubtopicIdAndBinding(topicId, subtopicId, binding) + viewModel.setSubtopicIdAndBinding(topicId, subtopicId, view) logRevisionCardEvent(topicId, subtopicId) binding.let { diff --git a/app/src/main/java/org/oppia/app/walkthrough/WalkthroughFragmentChangeListener.kt b/app/src/main/java/org/oppia/app/walkthrough/WalkthroughFragmentChangeListener.kt new file mode 100644 index 00000000000..dc44433ef31 --- /dev/null +++ b/app/src/main/java/org/oppia/app/walkthrough/WalkthroughFragmentChangeListener.kt @@ -0,0 +1,7 @@ +package org.oppia.app.walkthrough + +/** Listener for when an activity should change a fragment position. */ +interface WalkthroughFragmentChangeListener { + fun currentPage(walkthroughPage: Int) + fun pageWithTopicId(walkthroughPage: Int, topicId: String) +}