Skip to content

Commit

Permalink
Both Bazel and Gradle are building
Browse files Browse the repository at this point in the history
  • Loading branch information
miaboloix committed Aug 10, 2020
1 parent 5173867 commit 3ff4be0
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 15 deletions.
34 changes: 28 additions & 6 deletions app/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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)
''',
)

Expand All @@ -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)
''',
)

Expand All @@ -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(
Expand All @@ -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)
''',
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 19 additions & 3 deletions app/src/main/java/org/oppia/app/home/HomeFragmentPresenter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
) {
Expand All @@ -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)
Expand Down Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
}

0 comments on commit 3ff4be0

Please sign in to comment.