Skip to content

Commit

Permalink
Merge branch 'oppia:develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
prafulbbandre authored Aug 9, 2023
2 parents c1d5520 + c225110 commit 871d68b
Show file tree
Hide file tree
Showing 50 changed files with 689 additions and 119 deletions.
2 changes: 1 addition & 1 deletion app/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ VIEW_MODELS_WITH_RESOURCE_IMPORTS = [
"src/main/java/org/oppia/android/app/topic/lessons/ChapterSummaryViewModel.kt",
"src/main/java/org/oppia/android/app/topic/lessons/StorySummaryViewModel.kt",
"src/main/java/org/oppia/android/app/topic/questionplayer/QuestionPlayerViewModel.kt",
"src/main/java/org/oppia/android/app/topic/revisioncard/RevisionCardViewModel.kt",
"src/main/java/org/oppia/android/app/utility/RatioExtensions.kt",
"src/main/java/org/oppia/android/app/walkthrough/topiclist/topiclistviewmodel/WalkthroughTopicSummaryViewModel.kt",
]
Expand Down Expand Up @@ -365,7 +366,6 @@ VIEW_MODELS = [
"src/main/java/org/oppia/android/app/topic/practice/TopicPracticeViewModel.kt",
"src/main/java/org/oppia/android/app/topic/revision/revisionitemviewmodel/TopicRevisionItemViewModel.kt",
"src/main/java/org/oppia/android/app/topic/revision/TopicRevisionViewModel.kt",
"src/main/java/org/oppia/android/app/topic/revisioncard/RevisionCardViewModel.kt",
"src/main/java/org/oppia/android/app/walkthrough/end/WalkthroughFinalViewModel.kt",
"src/main/java/org/oppia/android/app/walkthrough/topiclist/topiclistviewmodel/WalkthroughTopicHeaderViewModel.kt",
"src/main/java/org/oppia/android/app/walkthrough/topiclist/WalkthroughTopicItemViewModel.kt",
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@
android:name=".app.survey.SurveyActivity"
android:label="@string/survey_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar"
android:windowSoftInputMode="adjustResize" />
android:windowSoftInputMode="adjustNothing" />

<provider
android:name="androidx.work.impl.WorkManagerInitializer"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class SurveyOnboardingBackgroundView : View {
strokeWidth = this@SurveyOnboardingBackgroundView.strokeWidth
color = ContextCompat.getColor(
context,
R.color.component_color_survey_onboarding_background_color
R.color.component_color_survey_popup_background_color
)
}
setBackgroundColor(Color.TRANSPARENT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class HintsAndSolutionDialogFragmentPresenter @Inject constructor(
HintsAndSolutionFragmentBinding.inflate(inflater, container, /* attachToRoot= */ false)
binding.hintsAndSolutionToolbar.setNavigationIcon(R.drawable.ic_close_white_24dp)
binding.hintsAndSolutionToolbar.setNavigationContentDescription(
R.string.hints_andSolution_close_icon_description
R.string.hints_and_solution_close_icon_description
)
binding.hintsAndSolutionToolbar.setNavigationOnClickListener {
(fragment.requireActivity() as? HintsAndSolutionListener)?.dismiss()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ class ExplorationActivityPresenter @Inject constructor(
oppiaLogger.d("ExplorationActivity", "Successfully stopped exploration")
if (isCompletion) {
maybeShowSurveyDialog(profileId, topicId)
} else {
backPressActivitySelector()
}
}
}
Expand All @@ -310,8 +312,6 @@ class ExplorationActivityPresenter @Inject constructor(
* current exploration.
*/
fun backButtonPressed() {
// check if survey should be shown
maybeShowSurveyDialog(profileId, topicId)
// If checkpointing is not enabled, show StopExplorationDialogFragment to exit the exploration,
// this is expected to happen if the exploration is marked as completed.
if (!isCheckpointingEnabled) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ class ExitSurveyConfirmationDialogFragment : InjectableDialogFragment() {

val profileId = args.getProto(PROFILE_ID_KEY, ProfileId.getDefaultInstance())

dialog?.setCanceledOnTouchOutside(false)
dialog?.setCancelable(false)

return exitSurveyConfirmationDialogFragmentPresenter.handleCreateView(
inflater,
container
Expand Down
11 changes: 10 additions & 1 deletion app/src/main/java/org/oppia/android/app/survey/SurveyActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,27 @@ class SurveyActivity : InjectableAutoLocalizedAppCompatActivity() {
@Inject
lateinit var surveyActivityPresenter: SurveyActivityPresenter

private lateinit var profileId: ProfileId

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
(activityComponent as ActivityComponentImpl).inject(this)

val params = intent.extractParams()
this.profileId = params.profileId ?: ProfileId.newBuilder().setInternalId(-1).build()

surveyActivityPresenter.handleOnCreate(
params.profileId,
profileId,
params.topicId,
params.explorationId
)
}

override fun onBackPressed() {
val dialogFragment = ExitSurveyConfirmationDialogFragment.newInstance(profileId)
dialogFragment.showNow(supportFragmentManager, TAG_EXIT_SURVEY_CONFIRMATION_DIALOG)
}

companion object {
private const val PARAMS_KEY = "SurveyActivity.params"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import org.oppia.android.app.model.SurveyQuestionName
import org.oppia.android.databinding.SurveyWelcomeDialogFragmentBinding
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.survey.SurveyController
import org.oppia.android.util.data.AsyncResult
import org.oppia.android.util.data.DataProviders.Companion.toLiveData
Expand All @@ -25,7 +26,8 @@ class SurveyWelcomeDialogFragmentPresenter @Inject constructor(
private val fragment: Fragment,
private val surveyController: SurveyController,
private val oppiaLogger: OppiaLogger,
private val analyticsController: AnalyticsController
private val analyticsController: AnalyticsController,
private val profileManagementController: ProfileManagementController
) {
private lateinit var explorationId: String

Expand Down Expand Up @@ -54,6 +56,7 @@ class SurveyWelcomeDialogFragmentPresenter @Inject constructor(
.commitNow()
}

profileManagementController.updateSurveyLastShownTimestamp(profileId)
logSurveyPopUpShownEvent(explorationId, topicId, profileId)

return binding.root
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ package org.oppia.android.app.topic.revisioncard
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.LiveData
import androidx.lifecycle.Transformations
import org.oppia.android.R
import org.oppia.android.app.model.EphemeralRevisionCard
import org.oppia.android.app.model.EphemeralSubtopic
import org.oppia.android.app.model.EphemeralTopic
import org.oppia.android.app.model.ProfileId
import org.oppia.android.app.topic.RouteToRevisionCardListener
import org.oppia.android.app.translation.AppLanguageResourceHandler
import org.oppia.android.app.viewmodel.ObservableViewModel
import org.oppia.android.domain.oppialogger.OppiaLogger
import org.oppia.android.domain.topic.TopicController
Expand Down Expand Up @@ -36,6 +38,7 @@ class RevisionCardViewModel private constructor(
val topicId: String,
val subtopicId: Int,
val profileId: ProfileId,
private val appLanguageResourceHandler: AppLanguageResourceHandler,
val subtopicListSize: Int
) : ObservableViewModel() {

Expand Down Expand Up @@ -100,6 +103,21 @@ class RevisionCardViewModel private constructor(
} ?: ""
}

/** Returns the content description of the subtopic. */
fun computeContentDescriptionText(subtopicLiveData: LiveData<EphemeralSubtopic>): String {
return when (subtopicLiveData) {
previousSubtopicLiveData -> appLanguageResourceHandler.getStringInLocaleWithWrapping(
R.string.previous_subtopic_talkback_text,
computeTitleText(previousSubtopicLiveData.value)
)
nextSubtopicLiveData -> appLanguageResourceHandler.getStringInLocaleWithWrapping(
R.string.next_subtopic_talkback_text,
computeTitleText(nextSubtopicLiveData.value)
)
else -> ""
}
}

private fun processPreviousSubtopicData(
topicLiveData: AsyncResult<EphemeralTopic>
): EphemeralSubtopic {
Expand Down Expand Up @@ -157,6 +175,7 @@ class RevisionCardViewModel private constructor(
private val topicController: TopicController,
private val oppiaLogger: OppiaLogger,
@TopicHtmlParserEntityType private val entityType: String,
private val appLanguageResourceHandler: AppLanguageResourceHandler,
private val translationController: TranslationController
) {
/** Returns a new [RevisionCardViewModel]. */
Expand All @@ -175,6 +194,7 @@ class RevisionCardViewModel private constructor(
topicId,
subtopicId,
profileId,
appLanguageResourceHandler,
subtopicListSize
)
}
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/nps_survey_button_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="@dimen/survey_button_corner_radius" />
<solid android:color="@color/component_color_shared_button_active_solid_color" />
<stroke
android:width="1dp"
android:color="@color/component_color_shared_button_active_stroke_color" />
</shape>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="@dimen/survey_button_corner_radius" />
<solid android:color="@color/component_color_shared_button_inactive_solid_color" />
<stroke
android:width="1dp"
android:color="@color/component_color_nps_survey_button_inactive_stroke_color" />
</shape>
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="@dimen/survey_shared_corner_radius" />
<solid android:color="@color/component_color_survey_background_color" />
<solid android:color="@color/component_color_survey_white_button_color" />
<stroke
android:width="1dp"
android:color="@color/component_color_survey_primary_button_background_color" />
android:color="@color/component_color_shared_button_active_stroke_color" />
</shape>
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="@dimen/survey_shared_corner_radius" />
<solid android:color="@color/component_color_survey_primary_button_background_color" />
<solid android:color="@color/component_color_survey_green_button_color" />
<stroke
android:width="1dp"
android:color="@color/component_color_survey_shared_button_color" />
android:color="@color/component_color_survey_white_button_color" />
</shape>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="@dimen/survey_shared_corner_radius" />
<solid android:color="@color/component_color_shared_white_background_color" />
<solid android:color="@color/component_color_shared_screen_primary_background_color" />
<stroke
android:width="2dp"
android:color="@color/component_color_survey_dialog_stroke_color" />
Expand Down
7 changes: 0 additions & 7 deletions app/src/main/res/drawable/survey_next_button_background.xml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:tint="#15716A"
android:tint="@color/component_color_survey_nps_selected_background_color"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/drawable/survey_nps_radio_text_color.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/component_color_shared_secondary_4_text_color" android:state_enabled="true" />
<item android:color="@color/component_color_shared_active_text_color" android:state_enabled="false" />
<item android:color="@color/component_color_survey_nps_selected_text_color" android:state_enabled="true" />
<item android:color="@color/component_color_survey_nps_unselected_text_color" android:state_enabled="false" />
</selector>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:tint="#E2F5F4"
android:tint="@color/component_color_survey_nps_unselected_background_color"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/drawable/survey_progress_bar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
<scale android:scaleWidth="100%">
<shape>
<corners android:radius="0dp" />
<solid android:color="@color/component_color_shared_progress_bar_solid_color" />
<solid android:color="@color/component_color_survey_progress_bar_solid_color" />
<stroke
android:width="1dp"
android:color="@color/component_color_shared_progress_bar_background_color" />
android:color="@color/component_color_shared_white_background_color" />
</shape>
</scale>
</item>
Expand Down
7 changes: 0 additions & 7 deletions app/src/main/res/drawable/survey_submit_button_background.xml

This file was deleted.

Loading

0 comments on commit 871d68b

Please sign in to comment.