Skip to content

Commit

Permalink
Merge branch 'develop' into profile_id_provision_feature
Browse files Browse the repository at this point in the history
# Conflicts:
#	app/src/main/java/org/oppia/android/app/home/recentlyplayed/RecentlyPlayedFragmentPresenter.kt
#	app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/learneranalytics/ProfileAndDeviceIdActivityTest.kt
#	app/src/sharedTest/java/org/oppia/android/app/profileprogress/ProfileProgressFragmentTest.kt
  • Loading branch information
KevinGitonga committed Aug 23, 2023
2 parents 8c7aaa7 + d74576d commit 0eb896c
Show file tree
Hide file tree
Showing 164 changed files with 8,838 additions and 677 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
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ dependencies {
'androidx.test.espresso:espresso-core:3.2.0',
'androidx.test.espresso:espresso-intents:3.1.0',
'androidx.test.ext:junit:1.1.1',
'androidx.test.ext:truth:1.4.0',
'com.github.bumptech.glide:mocks:4.11.0',
'com.google.truth:truth:1.1.3',
'androidx.work:work-testing:2.4.0',
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,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 @@ -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 0eb896c

Please sign in to comment.