Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/oppia#3843' into oppia#3843
Browse files Browse the repository at this point in the history
  • Loading branch information
XichengSpencer committed Sep 19, 2023
2 parents 24050dc + 3406c78 commit b1bfe10
Show file tree
Hide file tree
Showing 179 changed files with 9,349 additions and 686 deletions.
17 changes: 16 additions & 1 deletion app/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ LISTENERS = [
"src/main/java/org/oppia/android/app/recyclerview/OnItemDragListener.kt",
"src/main/java/org/oppia/android/app/settings/profile/LoadProfileEditDeletionDialogListener.kt",
"src/main/java/org/oppia/android/app/settings/profile/RouteToProfileEditListener.kt",
"src/main/java/org/oppia/android/app/survey/SelectedAnswerAvailabilityReceiver.kt",
"src/main/java/org/oppia/android/app/topic/RouteToRevisionCardListener.kt",
"src/main/java/org/oppia/android/app/topic/lessons/ChapterSummarySelector.kt",
"src/main/java/org/oppia/android/app/topic/lessons/StorySummarySelector.kt",
Expand Down Expand Up @@ -209,6 +210,7 @@ VIEW_MODELS_WITH_RESOURCE_IMPORTS = [
"src/main/java/org/oppia/android/app/home/promotedlist/PromotedStoryListViewModel.kt",
"src/main/java/org/oppia/android/app/home/promotedlist/PromotedStoryViewModel.kt",
"src/main/java/org/oppia/android/app/home/recentlyplayed/PromotedStoryViewModel.kt",
"src/main/java/org/oppia/android/app/home/recentlyplayed/RecentlyPlayedViewModel.kt",
"src/main/java/org/oppia/android/app/home/topiclist/TopicSummaryViewModel.kt",
"src/main/java/org/oppia/android/app/onboarding/OnboadingSlideViewModel.kt",
"src/main/java/org/oppia/android/app/onboarding/OnboardingViewModel.kt",
Expand All @@ -235,11 +237,18 @@ VIEW_MODELS_WITH_RESOURCE_IMPORTS = [
"src/main/java/org/oppia/android/app/profileprogress/RecentlyPlayedStorySummaryViewModel.kt",
"src/main/java/org/oppia/android/app/story/storyitemviewmodel/StoryChapterSummaryViewModel.kt",
"src/main/java/org/oppia/android/app/story/storyitemviewmodel/StoryHeaderViewModel.kt",
"src/main/java/org/oppia/android/app/survey/SurveyViewModel.kt",
"src/main/java/org/oppia/android/app/survey/surveyitemviewmodel/FreeFormItemsViewModel.kt",
"src/main/java/org/oppia/android/app/survey/surveyitemviewmodel/MarketFitItemsViewModel.kt",
"src/main/java/org/oppia/android/app/survey/surveyitemviewmodel/MultipleChoiceOptionContentViewModel.kt",
"src/main/java/org/oppia/android/app/survey/surveyitemviewmodel/NpsItemsViewModel.kt",
"src/main/java/org/oppia/android/app/survey/surveyitemviewmodel/UserTypeItemsViewModel.kt",
"src/main/java/org/oppia/android/app/topic/TopicViewModel.kt",
"src/main/java/org/oppia/android/app/topic/info/TopicInfoViewModel.kt",
"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 @@ -342,6 +351,7 @@ VIEW_MODELS = [
"src/main/java/org/oppia/android/app/story/StoryFragmentScroller.kt",
"src/main/java/org/oppia/android/app/story/storyitemviewmodel/StoryItemViewModel.kt",
"src/main/java/org/oppia/android/app/story/StoryViewModel.kt",
"src/main/java/org/oppia/android/app/survey/surveyitemviewmodel/SurveyAnswerItemViewModel.kt",
"src/main/java/org/oppia/android/app/testing/BindableAdapterTestDataModel.kt",
"src/main/java/org/oppia/android/app/testing/BindableAdapterTestViewModel.kt",
"src/main/java/org/oppia/android/app/testing/CircularProgressIndicatorAdaptersTestViewModel.kt",
Expand All @@ -356,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 Expand Up @@ -402,7 +411,10 @@ VIEWS_WITH_RESOURCE_IMPORTS = [
"src/main/java/org/oppia/android/app/customview/LessonThumbnailImageView.kt",
"src/main/java/org/oppia/android/app/customview/PromotedStoryCardView.kt",
"src/main/java/org/oppia/android/app/customview/SegmentedCircularProgressView.kt",
"src/main/java/org/oppia/android/app/customview/SurveyOnboardingBackgroundView.kt",
"src/main/java/org/oppia/android/app/customview/VerticalDashedLineView.kt",
"src/main/java/org/oppia/android/app/survey/SurveyMultipleChoiceOptionView.kt",
"src/main/java/org/oppia/android/app/survey/SurveyNpsItemOptionView.kt",
"src/main/java/org/oppia/android/app/utility/ClickableAreasImage.kt",
]

Expand Down Expand Up @@ -621,6 +633,7 @@ kt_android_library(
"//domain/src/main/java/org/oppia/android/domain/audio:cellular_audio_dialog_controller",
"//model/src/main/proto:arguments_java_proto_lite",
"//model/src/main/proto:question_java_proto_lite",
"//model/src/main/proto:survey_java_proto_lite",
"//model/src/main/proto:topic_java_proto_lite",
"//third_party:androidx_recyclerview_recyclerview",
],
Expand Down Expand Up @@ -781,6 +794,8 @@ kt_android_library(
"//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener",
"//domain/src/main/java/org/oppia/android/domain/profile:profile_management_controller",
"//domain/src/main/java/org/oppia/android/domain/spotlight:spotlight_state_controller",
"//domain/src/main/java/org/oppia/android/domain/survey:gating_controller",
"//domain/src/main/java/org/oppia/android/domain/survey:survey_controller",
"//model/src/main/proto:arguments_java_proto_lite",
"//third_party:androidx_databinding_databinding-adapters",
"//third_party:androidx_databinding_databinding-common",
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
<activity
android:name=".app.profile.AdminPinActivity"
android:label="@string/admin_pin_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".app.profile.PinPasswordActivity"
Expand Down Expand Up @@ -307,6 +308,11 @@
<activity
android:name=".app.testing.activity.TestActivity"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.survey.SurveyActivity"
android:label="@string/survey_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar"
android:windowSoftInputMode="adjustNothing" />

<provider
android:name="androidx.work.impl.WorkManagerInitializer"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import org.oppia.android.app.settings.profile.ProfileRenameActivity
import org.oppia.android.app.settings.profile.ProfileResetPinActivity
import org.oppia.android.app.splash.SplashActivity
import org.oppia.android.app.story.StoryActivity
import org.oppia.android.app.survey.SurveyActivity
import org.oppia.android.app.testing.AdministratorControlsFragmentTestActivity
import org.oppia.android.app.testing.AppCompatCheckBoxBindingAdaptersTestActivity
import org.oppia.android.app.testing.AudioFragmentTestActivity
Expand Down Expand Up @@ -206,4 +207,5 @@ interface ActivityComponentImpl :
fun inject(viewEventLogsActivity: ViewEventLogsActivity)
fun inject(viewEventLogsTestActivity: ViewEventLogsTestActivity)
fun inject(walkthroughActivity: WalkthroughActivity)
fun inject(surveyActivity: SurveyActivity)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
package org.oppia.android.app.customview

import android.content.Context
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.graphics.Path
import android.util.AttributeSet
import android.view.View
import androidx.core.content.ContextCompat
import androidx.core.view.ViewCompat
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import org.oppia.android.R
import org.oppia.android.app.translation.AppLanguageResourceHandler
import org.oppia.android.app.view.ViewComponentFactory
import org.oppia.android.app.view.ViewComponentImpl
import javax.inject.Inject

/**
* CustomView to add a background to [SurveyWelcomeDialogFragment] and [SurveyOutroDialogFragment].
* Without chaptersFinished and totalChapters values this custom-view cannot be created.
*
* Reference: // https://proandroiddev.com/how-i-drew-custom-shapes-in-bottom-bar-c4539d86afd7 and
* // https://ciechanow.ski/drawing-bezier-curves/
*/
class SurveyOnboardingBackgroundView : View {
@Inject
lateinit var resourceHandler: AppLanguageResourceHandler

private val isRtl by lazy {
resourceHandler.getLayoutDirection() == ViewCompat.LAYOUT_DIRECTION_RTL
}

private lateinit var paint: Paint
private lateinit var path: Path
private var strokeWidth = 2f

constructor(context: Context) : super(context)
constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(
context,
attrs,
defStyleAttr
)

init {
setupCurvePaint()
}

override fun onDraw(canvas: Canvas) {
if (isRtl)
rotationY = 180f
super.onDraw(canvas)

canvas.drawPath(path, paint)
}

override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
super.onSizeChanged(w, h, oldw, oldh)
val width = this.width.toFloat()
val height = this.height.toFloat()

val controlPoint1X = width * 0.5f
val controlPoint1Y = 0f

val controlPoint2X = width * 0.5f
val controlPoint2Y = height * 0.2f

val controlPoint3X = width * 1f
val controlPoint3Y = height * 0.1f

path.reset()
path.moveTo(0f, height * 0.1f)
path.cubicTo(
controlPoint1X,
controlPoint1Y,
controlPoint2X,
controlPoint2Y,
controlPoint3X,
controlPoint3Y
)

path.lineTo(width, height)
path.lineTo(0f, height)
path.lineTo(0f, 0f)
}

private fun setupCurvePaint() {
path = Path()
paint = Paint(Paint.ANTI_ALIAS_FLAG)
paint.apply {
style = Paint.Style.FILL_AND_STROKE
strokeWidth = this@SurveyOnboardingBackgroundView.strokeWidth
color = ContextCompat.getColor(
context,
R.color.component_color_survey_popup_background_color
)
}
setBackgroundColor(Color.TRANSPARENT)
}

override fun onAttachedToWindow() {
super.onAttachedToWindow()

val viewComponentFactory = FragmentManager.findFragment<Fragment>(this) as ViewComponentFactory
val viewComponent = viewComponentFactory.createViewComponent(this) as ViewComponentImpl
viewComponent.inject(this)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ import org.oppia.android.app.shim.IntentFactoryShimModule
import org.oppia.android.app.shim.ViewBindingShimModule
import org.oppia.android.app.spotlight.SpotlightFragment
import org.oppia.android.app.story.StoryFragment
import org.oppia.android.app.survey.ExitSurveyConfirmationDialogFragment
import org.oppia.android.app.survey.SurveyFragment
import org.oppia.android.app.survey.SurveyOutroDialogFragment
import org.oppia.android.app.survey.SurveyWelcomeDialogFragment
import org.oppia.android.app.testing.DragDropTestFragment
import org.oppia.android.app.testing.ExplorationTestActivityPresenter
import org.oppia.android.app.testing.ImageRegionSelectionTestFragment
Expand Down Expand Up @@ -177,4 +181,8 @@ interface FragmentComponentImpl : FragmentComponent, ViewComponentBuilderInjecto
fun inject(walkthroughFinalFragment: WalkthroughFinalFragment)
fun inject(walkthroughTopicListFragment: WalkthroughTopicListFragment)
fun inject(walkthroughWelcomeFragment: WalkthroughWelcomeFragment)
fun inject(surveyFragment: SurveyFragment)
fun inject(exitSurveyConfirmationDialogFragment: ExitSurveyConfirmationDialogFragment)
fun inject(surveyWelcomeDialogFragment: SurveyWelcomeDialogFragment)
fun inject(surveyOutroDialogFragment: SurveyOutroDialogFragment)
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import org.oppia.android.R
import org.oppia.android.app.activity.ActivityScope
import org.oppia.android.app.translation.AppLanguageResourceHandler
import org.oppia.android.databinding.LicenseTextViewerActivityBinding
import org.oppia.android.util.accessibility.AccessibilityService
import javax.inject.Inject

/** The presenter for [LicenseTextViewerActivity]. */
Expand All @@ -14,6 +15,7 @@ class LicenseTextViewerActivityPresenter @Inject constructor(
private val activity: AppCompatActivity,
private val resourceHandler: AppLanguageResourceHandler
) {
@Inject lateinit var accessibilityService: AccessibilityService

/** Handles onCreate() method of the [LicenseTextViewerActivity]. */
fun handleOnCreate(dependencyIndex: Int, licenseIndex: Int) {
Expand Down Expand Up @@ -44,8 +46,10 @@ class LicenseTextViewerActivityPresenter @Inject constructor(
(activity as LicenseTextViewerActivity).finish()
}

binding.licenseTextViewerActivityToolbarTitle.setOnClickListener {
binding.licenseTextViewerActivityToolbarTitle.isSelected = true
if (!accessibilityService.isScreenReaderEnabled()) {
binding.licenseTextViewerActivityToolbarTitle.setOnClickListener {
binding.licenseTextViewerActivityToolbarTitle.isSelected = true
}
}

if (getLicenseTextViewerFragment() == null) {
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

This file was deleted.

Loading

0 comments on commit b1bfe10

Please sign in to comment.