Skip to content

Commit

Permalink
Merge branch 'develop' into eventlog-subject-Test
Browse files Browse the repository at this point in the history
  • Loading branch information
theayushyadav11 authored Feb 10, 2025
2 parents 50668e3 + f94dcdc commit 892908f
Show file tree
Hide file tree
Showing 16 changed files with 51 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import org.oppia.android.app.translation.AppLanguageResourceHandler
import org.oppia.android.util.extensions.getProto
import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.decorateWithScreenName
import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.decorateWithUserProfileId
import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.extractCurrentUserProfileId
import javax.inject.Inject

/** Argument key used to identify [ProfileListFragment] in the backstack. */
Expand Down Expand Up @@ -75,7 +76,7 @@ class AdministratorControlsActivity :
// TODO(#661): Change the default fragment in the right hand side to be EditAccount fragment in the case of multipane controls.
PROFILE_LIST_FRAGMENT
}
val selectedProfileId = args?.selectedProfileId ?: -1
val selectedProfileId = intent?.extractCurrentUserProfileId() ?: ProfileId.getDefaultInstance()

administratorControlsActivityPresenter.handleOnCreate(
extraControlsTitle,
Expand Down Expand Up @@ -107,7 +108,7 @@ class AdministratorControlsActivity :
startActivity(ProfileAndDeviceIdActivity.createIntent(this))
}

override fun loadProfileEdit(profileId: Int, profileName: String) {
override fun loadProfileEdit(profileId: ProfileId, profileName: String) {
lastLoadedFragment = PROFILE_EDIT_FRAGMENT
administratorControlsActivityPresenter.loadProfileEdit(profileId, profileName)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ import org.oppia.android.app.administratorcontrols.appversion.AppVersionFragment
import org.oppia.android.app.administratorcontrols.learneranalytics.ProfileAndDeviceIdFragment
import org.oppia.android.app.drawer.NavigationDrawerFragment
import org.oppia.android.app.model.AdministratorControlActivityStateBundle
import org.oppia.android.app.model.ProfileId
import org.oppia.android.app.settings.profile.LoadProfileEditDeletionDialogListener
import org.oppia.android.app.settings.profile.ProfileEditFragment
import org.oppia.android.app.settings.profile.ProfileListFragment
import org.oppia.android.app.translation.AppLanguageResourceHandler
import org.oppia.android.databinding.AdministratorControlsActivityBinding
import org.oppia.android.util.extensions.putProto
import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.decorateWithUserProfileId
import javax.inject.Inject

/** The presenter for [AdministratorControlsActivity]. */
Expand All @@ -29,15 +31,15 @@ class AdministratorControlsActivityPresenter @Inject constructor(
private lateinit var binding: AdministratorControlsActivityBinding

private lateinit var lastLoadedFragment: String
private var selectedProfileId: Int = -1
private var selectedProfileId: ProfileId = ProfileId.getDefaultInstance()
private lateinit var extraControlsTitle: String
private var isProfileDeletionDialogVisible: Boolean = false

/** Initializes the [AdministratorControlsActivity] and sets the navigation drawer. */
fun handleOnCreate(
extraControlsTitle: String?,
lastLoadedFragment: String,
selectedProfileId: Int,
selectedProfileId: ProfileId,
isProfileDeletionDialogVisible: Boolean
) {
binding = DataBindingUtil.setContentView(
Expand Down Expand Up @@ -68,7 +70,7 @@ class AdministratorControlsActivityPresenter @Inject constructor(
PROFILE_EDIT_FRAGMENT -> selectedProfileId.let { profileId ->
if (extraControlsTitle != null) {
activity.loadProfileEdit(profileId = profileId, profileName = extraControlsTitle)
if (isProfileDeletionDialogVisible && profileId != 0) {
if (isProfileDeletionDialogVisible && profileId.internalId != 0) {
val fragment = activity.supportFragmentManager.findFragmentById(
R.id.administrator_controls_fragment_multipane_placeholder
)
Expand Down Expand Up @@ -142,13 +144,13 @@ class AdministratorControlsActivityPresenter @Inject constructor(
}

/** Loads the [ProfileEditFragment] when the user clicks on a profile in tablet multipane mode. */
fun loadProfileEdit(profileId: Int, profileName: String) {
fun loadProfileEdit(profileId: ProfileId, profileName: String) {
lastLoadedFragment = PROFILE_EDIT_FRAGMENT
selectedProfileId = profileId
extraControlsTitle = profileName
setExtraControlsTitle(extraControlsTitle)
setMultipaneBackButtonVisibility(View.VISIBLE)
val fragment = ProfileEditFragment.newInstance(profileId, isMultipane)
val fragment = ProfileEditFragment.newInstance(profileId.internalId, isMultipane)
activity.supportFragmentManager.beginTransaction().replace(
R.id.administrator_controls_fragment_multipane_placeholder,
fragment
Expand Down Expand Up @@ -209,9 +211,11 @@ class AdministratorControlsActivityPresenter @Inject constructor(
this@AdministratorControlsActivityPresenter.isProfileDeletionDialogVisible.let {
isProfileDeletionDialogVisible = it
}
selectedProfileId = this@AdministratorControlsActivityPresenter.selectedProfileId
}
.build()
outState.decorateWithUserProfileId(
this@AdministratorControlsActivityPresenter.selectedProfileId
)
outState.putProto(ADMINISTRATOR_CONTROLS_ACTIVITY_STATE_KEY, args)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class AdministratorControlsFragmentPresenter @Inject constructor(
) {
private lateinit var binding: AdministratorControlsFragmentBinding
private lateinit var linearLayoutManager: LinearLayoutManager
private var internalProfileId: Int = -1
private lateinit var profileId: ProfileId

@Inject
Expand All @@ -56,8 +55,7 @@ class AdministratorControlsFragmentPresenter @Inject constructor(
/* attachToRoot= */ false
)

internalProfileId = activity.intent.extractCurrentUserProfileId().internalId
profileId = ProfileId.newBuilder().setInternalId(internalProfileId).build()
profileId = activity.intent.extractCurrentUserProfileId()
administratorControlsViewModel.setProfileId(profileId)

linearLayoutManager = LinearLayoutManager(activity.applicationContext)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package org.oppia.android.app.administratorcontrols

import org.oppia.android.app.model.ProfileId

/** Listener for when an activity should load [ProfileEditFragment]. */
interface LoadProfileEditListener {
/** Inflates [ProfileEditFragment] as part of a tablet mode a multipane fragment. */
fun loadProfileEdit(profileId: Int, profileName: String)
fun loadProfileEdit(profileId: ProfileId, profileName: String)
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package org.oppia.android.app.settings.profile

import org.oppia.android.app.model.ProfileId

/** Listener for when the activity should inflate [ProfileEditDeletionDialogFragment]. */
interface LoadProfileEditDeletionDialogListener {
/**
* Inflates [ProfileEditDeletionDialogFragment] for the configuration changes, i.e. rotating the device
* from landscape to portrait, and saves the state of the dialog.
*/
fun loadProfileEditDeletionDialog(internalProfileId: Int)
fun loadProfileEditDeletionDialog(profileId: ProfileId)
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import android.view.ViewGroup
import org.oppia.android.app.fragment.FragmentComponentImpl
import org.oppia.android.app.fragment.InjectableFragment
import org.oppia.android.app.model.ProfileEditFragmentArguments
import org.oppia.android.app.model.ProfileId
import org.oppia.android.util.extensions.getProto
import org.oppia.android.util.extensions.putProto
import javax.inject.Inject
Expand Down Expand Up @@ -74,7 +75,7 @@ class ProfileEditFragment :
profileEditFragmentPresenter.deleteProfile(internalProfileId)
}

override fun loadProfileEditDeletionDialog(internalProfileId: Int) {
profileEditFragmentPresenter.handleLoadProfileDeletionDialog(internalProfileId)
override fun loadProfileEditDeletionDialog(profileId: ProfileId) {
profileEditFragmentPresenter.handleLoadProfileDeletionDialog(profileId.internalId)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class ProfileListFragmentPresenter @Inject constructor(
routeToProfileEditListener.routeToProfileEditActivity(profile.id.internalId)
} else {
val loadProfileEditListener = (activity as LoadProfileEditListener)
loadProfileEditListener.loadProfileEdit(profile.id.internalId, profile.name)
loadProfileEditListener.loadProfileEdit(profile.id, profile.name)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class AdministratorControlsFragmentTestActivity :

override fun loadAppVersion() {}

override fun loadProfileEdit(profileId: Int, profileName: String) {}
override fun loadProfileEdit(profileId: ProfileId, profileName: String) {}

override fun showLogoutDialog() {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class TopicFragmentPresenter @Inject constructor(
fun startSpotlight() {
viewModel.numberOfChaptersCompletedLiveData.observe(fragment) { numberOfChaptersCompleted ->
if (numberOfChaptersCompleted != null) {
val lessonsTabView = tabLayout.getTabAt(computeTabPosition(TopicTab.LESSONS))?.view
val lessonsTabView = tabLayout.getTabAt(computeTabPosition(TopicTab.LEARN))?.view
lessonsTabView?.let {
val lessonsTabSpotlightTarget = SpotlightTarget(
lessonsTabView,
Expand All @@ -97,7 +97,7 @@ class TopicFragmentPresenter @Inject constructor(
checkNotNull(getSpotlightManager()).requestSpotlight(lessonsTabSpotlightTarget)

if (numberOfChaptersCompleted > 2) {
val revisionTabView = tabLayout.getTabAt(computeTabPosition(TopicTab.REVISION))?.view
val revisionTabView = tabLayout.getTabAt(computeTabPosition(TopicTab.STUDY))?.view
val revisionTabSpotlightTarget = SpotlightTarget(
revisionTabView!!,
resourceHandler.getStringInLocale(R.string.topic_revision_tab_spotlight_hint),
Expand Down Expand Up @@ -149,9 +149,9 @@ class TopicFragmentPresenter @Inject constructor(
}.attach()
if (!isConfigChanged && topicId.isNotEmpty()) {
if (enableExtraTopicTabsUi.value) {
setCurrentTab(if (storyId.isNotEmpty()) TopicTab.LESSONS else TopicTab.INFO)
setCurrentTab(if (storyId.isNotEmpty()) TopicTab.LEARN else TopicTab.INFO)
} else {
setCurrentTab(TopicTab.LESSONS)
setCurrentTab(TopicTab.LEARN)
}
}
viewPager2.registerOnPageChangeCallback(object : ViewPager2.OnPageChangeCallback() {
Expand All @@ -164,9 +164,9 @@ class TopicFragmentPresenter @Inject constructor(
private fun logTopicEvents(tab: TopicTab) {
val eventContext = when (tab) {
TopicTab.INFO -> oppiaLogger.createOpenInfoTabContext(topicId)
TopicTab.LESSONS -> oppiaLogger.createOpenLessonsTabContext(topicId)
TopicTab.LEARN -> oppiaLogger.createOpenLessonsTabContext(topicId)
TopicTab.PRACTICE -> oppiaLogger.createOpenPracticeTabContext(topicId)
TopicTab.REVISION -> oppiaLogger.createOpenRevisionTabContext(topicId)
TopicTab.STUDY -> oppiaLogger.createOpenRevisionTabContext(topicId)
}
analyticsController.logImportantEvent(eventContext, profileId)
}
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/java/org/oppia/android/app/topic/TopicTab.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ enum class TopicTab(
tabIconResId = R.drawable.ic_info_icon_24dp,
contentDescriptionResId = R.string.info_tab_content_description
),
LESSONS(
LEARN(
positionWithTwoTabs = 0,
positionWithFourTabs = 1,
tabLabelResId = R.string.lessons,
tabLabelResId = R.string.learn,
tabIconResId = R.drawable.ic_lessons_icon_24dp,
contentDescriptionResId = R.string.lessons_tab_content_description
),
Expand All @@ -33,10 +33,10 @@ enum class TopicTab(
tabIconResId = R.drawable.ic_practice_icon_24dp,
contentDescriptionResId = R.string.practice_tab_content_description
),
REVISION(
STUDY(
positionWithTwoTabs = 1,
positionWithFourTabs = 3,
tabLabelResId = R.string.revision,
tabLabelResId = R.string.study,
tabIconResId = R.drawable.ic_revision_icon_24dp,
contentDescriptionResId = R.string.revision_tab_content_description
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ class ViewPagerAdapter(
TopicTab.INFO -> {
TopicInfoFragment.newInstance(profileId, topicId)
}
TopicTab.LESSONS -> {
TopicTab.LEARN -> {
TopicLessonsFragment.newInstance(profileId, classroomId, topicId, storyId)
}
TopicTab.PRACTICE -> {
TopicPracticeFragment.newInstance(profileId, topicId)
}
TopicTab.REVISION -> {
TopicTab.STUDY -> {
TopicRevisionFragment.newInstance(profileId, topicId)
}
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -673,4 +673,5 @@
<string name="audio_language_fragment_text">في %s ، يمكنك الاستماع إلى الدروس!</string>
<string name="audio_language_fragment_subtitle">اختر لغة المقاطع الصوتية للاستماع إلى الدروس</string>
<string name="onboarding_step_count_five">الخطوة 5 من 5</string>
<string name="arabic_language_display_name_content_description">العربية</string>
</resources>
6 changes: 3 additions & 3 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<string name="concept_card_toolbar_title">Concept Card</string>
<string name="concept_card_one_button_text">Concept Card 1</string>
<string name="concept_card_two_button_text">Concept Card 2</string>
<string name="revision_card_toolbar_title">Revision Card</string>
<string name="revision_card_toolbar_title">Study Guide</string>
<string name="unsaved_exploration_dialog_title">Leave to Topic Page?</string>
<string name="unsaved_exploration_dialog_description">Your progress will not be saved.</string>
<string name="unsaved_exploration_dialog_leave_button">Leave</string>
Expand Down Expand Up @@ -82,9 +82,9 @@
<string name="onboarding_activity_title">Introduction</string>
<string name="frequently_asked_questions_FAQ">Frequently Asked Questions (FAQs)</string>
<string name="info">Info</string>
<string name="lessons">Lessons</string>
<string name="learn">Learn</string>
<string name="practice">Practice</string>
<string name="revision">Revision</string>
<string name="study">Study</string>
<string name="administrator_controls_title">Administrator Controls</string>
<string name="topic_page">Topic page</string>
<string name="topic_name">Topic: %s</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ This module contains all the activities and fragments, as well as the view, view
- **app/view** - Basic Dagger code for View implementation.
- **app/viewmodel** - Basic Dagger code for ViewModel implementation.

In addition to the above-mentioned subdirectories, this module also contains other subdirectories that contain activities, fragments, interfaces and view models for various screens in the app. These subdirectories follow the naming convention **app/<screen_name>**. For example, the subdirectory **app/resumeLesson** contains all the activities, fragments, interfaces and ViewModels used by the resume lesson screen.
In addition to the above-mentioned subdirectories, this module also contains other subdirectories that contain activities, fragments, interfaces and view models for various screens in the app. These subdirectories follow the naming convention **app/<screen_name>**. For example, the subdirectory **app/resumeLessonLesson** contains all the activities, fragments, interfaces and ViewModels used by the resume lesson screen.

#### 2. data

Expand Down Expand Up @@ -152,7 +152,7 @@ Following these steps would lead to completing the entire task with all the code
**Task:**
Finding code from a string ( e g., story name under lessons tab) that you see in UI when running the app all the way to the UI components, domain controllers and the tests ultimately behind that text appearing.
Finding code from a string ( e g., story name under Learn tab) that you see in UI when running the app all the way to the UI components, domain controllers and the tests ultimately behind that text appearing.
<img width="300" height="600" alt="example 2 task image" src="https://github.com/oppia/oppia-android/assets/76530270/a1785b0e-7c8e-4ece-a375-e9042f1002da">
Expand All @@ -162,7 +162,7 @@ Finding code from a string ( e g., story name under lessons tab) that you see in
1. The first step is to identify the id of the UI component that is responsible for displaying the text. We can do this by using the layout inspector of the android studio.
2. To do this, run the app on an emulator. Now navigate to the screen that displays the UI component, i.e. the lessons tab.
2. To do this, run the app on an emulator. Now navigate to the screen that displays the UI component, i.e. the Learn tab.
3. Next, open the layout inspector from the android studio, and click on the UI component displaying the story name. Now all the attributes of this UI component are displayed on the right side of the layout inspector. Here, you can see this UI component's id, i.e. story_name_text_view.
Expand Down
8 changes: 4 additions & 4 deletions wiki/Spotlight-Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ message Spotlight {
// Corresponds to the onboarding screen's next button.
SpotlightViewState onboarding_next_button = 1;
// Corresponds to the topic fragment's lessons tab.
// Corresponds to the topic fragment's Learn tab.
SpotlightViewState topic_lesson_tab = 2;
// Corresponds to the topic fragment's revision tab.
// Corresponds to the topic fragment's Study tab.
SpotlightViewState topic_revision_tab = 3;
// Add and describe your new spotlit feature here.
Expand All @@ -65,10 +65,10 @@ message SpotlightStateDatabase {
// Corresponds to the onboarding screen's next button.
SpotlightViewState onboarding_next_button = 1;
// Corresponds to the topic fragment's lessons tab.
// Corresponds to the topic fragment's Learn tab.
SpotlightViewState topic_lesson_tab = 2;
// Corresponds to the topic fragment's revision tab.
// Corresponds to the topic fragment's Study tab.
SpotlightViewState topic_revision_tab = 3;
// Similarly, add storage for your new feature here.
Expand Down
6 changes: 3 additions & 3 deletions wiki/Terminology-in-Oppia.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ C4 --> c6("Card-6")
3. **Promoted Story**: Promoted Story is mainly the recent Story/Chapter you played. It is shown on the "home screen" with heading text "Stories For You".
4. **Skill**: This is a concrete learning outcome that describes something that a learner should be able to do. It is usually stated in the form “Given X, compute/calculate/draw/etc. Y.” For example: “Given a fraction, identify its numerator.”
5. **Exploration/Chapter**: This is a structured learning experience that is part of a story, and provides the learner with an active way to learn new concepts, as well as targeted feedback. It is the core unit of learning in Oppia. The flow/screen that appears when any story is started is known as the Exploration/Chapter.
6. **Concept Card**: This is a non-story-based explanation of how to perform a particular skill. It serves as a reference/reminder for students who may have encountered the skill before but forgotten how to carry it out. These can be accessed from the "Revision" tab or are linked within the chapter you are playing.
6. **Concept Card**: This is a non-story-based explanation of how to perform a particular skill. It serves as a reference/reminder for students who may have encountered the skill before but forgotten how to carry it out. These can be accessed from the "Study" tab or are linked within the chapter you are playing.
7. **Question/QuestionPlayer**: This is a standalone question that may be used by students as part of a practice session.

8. **Study Guide/Revision Card**: A Study Guide summarizes key topics and concepts, helping users quickly review and reinforce what they have learned. Note that the UI displays "Study Guide" instead of "Revision Card", though the codebase still uses the term "revision card" for consistency.
## How to visit?

### Concept Card

`Home` --> `Choose Topic` --> `Revision Tab` --> `Select revision card` --> `Goto hyperlink present in description text`
`Home` --> `Choose Topic` --> `Study Tab` --> `Select Study Guide` --> `Goto hyperlink present in description text`

<img width="350" height="700" alt="Visit Concept Card" src="https://github.com/oppia/oppia-android/assets/76530270/d71c5fc2-92eb-4087-9660-9f463bb282a2">

Expand Down

0 comments on commit 892908f

Please sign in to comment.