Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix part of #5344, Fix Part of #5422 and Fix Part of #5012: Implement Classroom List Screen with Jetpack Compose #5437

Merged
merged 187 commits into from
Jun 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
187 commits
Select commit Hold shift + click to select a range
f6b1f60
Add ClassroomIdList & ClassroomSummary protos
theMr17 May 30, 2024
fdcf183
Add classroom_id & classroom_title fields
theMr17 May 30, 2024
a66a5ac
Add json & textproto test data
theMr17 May 30, 2024
b292594
Update controllers to add classroom references in topics and stories
theMr17 May 30, 2024
d68d1b5
Add and update tests for controller changes
theMr17 May 30, 2024
69352df
Remove ClassroomList model
theMr17 May 30, 2024
700a001
Fix ktlint issues
theMr17 May 30, 2024
9063bcd
Fix textproto syntax issue
theMr17 May 30, 2024
8ce636d
Fix textproto syntax issue
theMr17 May 30, 2024
dbe9842
TopicListController is updated to load all topics irrespective of the…
theMr17 May 31, 2024
238d96c
Fix failing tests of TopicControllerTest
theMr17 May 31, 2024
d5a8bc8
Update test_classroom_id_0.textproto
theMr17 May 31, 2024
db67666
Update test_classroom_id_1.textproto
theMr17 May 31, 2024
405f160
Update test_classroom_id_2.textproto
theMr17 May 31, 2024
ff3444f
Add classroom file names in domain assets list
theMr17 May 31, 2024
4c5f322
Update domain_assets.bzl
theMr17 May 31, 2024
2a26a2b
Remove classroom thumbnail data from test_classroom_id_0
theMr17 May 31, 2024
c22fead
Remove classroom thumbnail data from test_classroom_id_1
theMr17 May 31, 2024
6cb9146
Remove classroom thumbnail data from test_classroom_id_2
theMr17 May 31, 2024
b214206
Fix bazel lint issue
theMr17 May 31, 2024
884a675
Introduce topic_ids field for classrooms
theMr17 May 31, 2024
9fbfda3
Fix textproto formatting issue
theMr17 May 31, 2024
0ee6828
Introduce ClassroomController to surface getClassroomList function
theMr17 Jun 1, 2024
1954d60
Add tests for getClassroomList function
theMr17 Jun 1, 2024
0d39117
Fix ktlint issues
theMr17 Jun 1, 2024
4e0335f
Add kdoc for getClassroomList function
theMr17 Jun 1, 2024
a31850f
Add getTopicList to ClassroomController
theMr17 Jun 1, 2024
ae1b072
Add tests for getTopicList function
theMr17 Jun 1, 2024
ea5e65e
Fix tests
theMr17 Jun 1, 2024
714f57d
Fix ktlint issues
theMr17 Jun 1, 2024
e90f4d2
Fix tests
theMr17 Jun 1, 2024
637b704
Move test classroom id constants to ClassroomController
theMr17 Jun 1, 2024
008a233
Add missing import
theMr17 Jun 1, 2024
e3dbfde
Gate the createTopicList function
theMr17 Jun 1, 2024
9bec9d6
Fix tests
theMr17 Jun 2, 2024
4ceece2
Add kdoc for test classroom id constants
theMr17 Jun 2, 2024
a89b8a7
Update ProfileManagementController to store last selected classroom I…
theMr17 Jun 2, 2024
49ae0a4
Temporarily hard code default classroom ID in ProfileManagementContro…
theMr17 Jun 2, 2024
e957499
Return nullable classroom ID from ProfileManagementController
theMr17 Jun 2, 2024
6584fe7
Update checkProfile test
theMr17 Jun 2, 2024
48921d5
Remove getTopicList function from TopicListController
theMr17 Jun 2, 2024
52c5b13
Remove unused imports from TopicListController
theMr17 Jun 2, 2024
74e4edf
Revert "Remove unused imports from TopicListController"
theMr17 Jun 3, 2024
baea849
Revert "Remove getTopicList function from TopicListController"
theMr17 Jun 3, 2024
cb96baf
Revert "Gate the createTopicList function"
theMr17 Jun 3, 2024
2c894e8
Remove translationLocaleProvider from getClassroomList
theMr17 Jun 3, 2024
e1c9254
Add EphemeralClassroomSummary & ClassroomList objects
theMr17 Jun 5, 2024
1b3b02e
Merge remote-tracking branch 'upstream/multiple-classrooms-model-supp…
theMr17 Jun 5, 2024
a226a72
Replace List<ClassroomSummary> with ClassroomList
theMr17 Jun 5, 2024
c82994e
Remove classroom info from CompletedStory
theMr17 Jun 6, 2024
2649461
Fix error message
theMr17 Jun 6, 2024
857d296
Update comments
theMr17 Jun 6, 2024
693bfe8
Revert "Introduce topic_ids field for classrooms"
theMr17 Jun 6, 2024
a0bf50c
Add test thumbnails
theMr17 Jun 7, 2024
c9ae332
Refactor topicIdsList to use keys of topicPrerequisitesMay
theMr17 Jun 7, 2024
5f1fa81
Merge remote-tracking branch 'upstream/multiple-classrooms-model-supp…
theMr17 Jun 7, 2024
81a89a3
Fix kdoc checks
theMr17 Jun 7, 2024
d438cb5
Pass classroomId to createTopicList directly
theMr17 Jun 8, 2024
4de2222
Update kdoc comments
theMr17 Jun 12, 2024
223f217
Update variable name
theMr17 Jun 12, 2024
e6bd04b
Update kdoc and return default instances
theMr17 Jun 12, 2024
4b3d596
Merge branch 'develop' into multiple-classrooms-model-support
theMr17 Jun 12, 2024
2baca12
Merge remote-tracking branch 'upstream/multiple-classrooms-model-supp…
theMr17 Jun 12, 2024
73fb79e
Remove extra new line
theMr17 Jun 13, 2024
2432150
Move classroom titles to ephemeral objects and pass the class written…
theMr17 Jun 14, 2024
d2a454d
Remove classroom title from topic data files
theMr17 Jun 14, 2024
ac24de1
Fix regex validation checks
theMr17 Jun 14, 2024
6cf8ae4
Handle empty classroom id when the proto asset is overridden for tests
theMr17 Jun 15, 2024
3d91ac2
Remove classroom ID from topic data files
theMr17 Jun 20, 2024
8296e2e
Remove unused import & variable
theMr17 Jun 20, 2024
8c5a77b
Fetch classroom ID from topic ID
theMr17 Jun 20, 2024
37dc6a3
Update left out classroom ID fetching
theMr17 Jun 20, 2024
8d5f678
Merge remote-tracking branch 'upstream/multiple-classrooms-model-supp…
theMr17 Jun 20, 2024
b149154
Update ClassroomController per latest changes in model layer
theMr17 Jun 20, 2024
b694868
Fix ktlint check
theMr17 Jun 20, 2024
9a328e5
Merge branch 'develop' into multiple-classrooms-model-support
theMr17 Jun 20, 2024
0994300
Merge remote-tracking branch 'upstream/multiple-classrooms-model-supp…
theMr17 Jun 20, 2024
d621144
Create ClassroomListActivity, ClassroomListFragment & ClassroomListVi…
theMr17 Jun 20, 2024
0551bea
Gate the new ClassroomListActivity
theMr17 Jun 20, 2024
861c8f6
Remove unused variable
theMr17 Jun 21, 2024
7ed5171
Fix static checks
theMr17 Jun 21, 2024
c17e299
Add test files & exemptions
theMr17 Jun 21, 2024
e13d057
Add dummy test to ClassroomListFragmentTest
theMr17 Jun 21, 2024
678a0f8
Fix ktlint issue
theMr17 Jun 21, 2024
5191364
Add tests to verify the gating
theMr17 Jun 21, 2024
808c041
Fix tests
theMr17 Jun 21, 2024
4f571a3
Fix ktlint issue
theMr17 Jun 21, 2024
711cd7d
Revert "Fix ktlint issue"
theMr17 Jun 21, 2024
6287cea
Revert "Fix tests"
theMr17 Jun 21, 2024
6a0189c
Individually setup tests for MyDownloadsActivityTest
theMr17 Jun 21, 2024
e926110
Add Jetpack Compose dependencies on Gradle
theMr17 Jun 21, 2024
c1ae5ca
Add Jetpack Compose dependencies on Bazel
theMr17 Jun 21, 2024
11fdf94
Revert "Individually setup tests for MyDownloadsActivityTest"
theMr17 Jun 21, 2024
0ce26ef
Fix bazel lint issue
theMr17 Jun 21, 2024
4416138
Restrict gating logic tests to Espresso
theMr17 Jun 21, 2024
cfeb1b0
Update maven dependencies' licenses
theMr17 Jun 21, 2024
4ebd4e2
Migrate ProfileProgressActivity to ActivityResultContracts
theMr17 Jun 21, 2024
c1d54bb
Migrate AddProfileActivity to ActivityResultContracts
theMr17 Jun 21, 2024
a780f40
Migrate OptionsActivity to ActivityResultContracts
theMr17 Jun 21, 2024
dd1da9a
Fix ktlint issue
theMr17 Jun 22, 2024
1113e79
Add missing import
theMr17 Jun 22, 2024
727d1b3
Bump build tools to v30.0.2
theMr17 Jun 22, 2024
08b05a9
Bump minSdkVersion to 21 in app/BUILD.bazel
theMr17 Jun 22, 2024
7daff6b
Revert "Bump minSdkVersion to 21 in app/BUILD.bazel"
theMr17 Jun 22, 2024
cb97fbf
Bump minSdkVersion to 21 for oppia_kitkat
theMr17 Jun 22, 2024
889ff18
Bump minSdkVersion to 21 for dev_kitkat & alpha_kitkat
theMr17 Jun 22, 2024
5a272ef
Bump minSdkVersion to 21 for tests
theMr17 Jun 22, 2024
788e5e2
Bump minSdkVersion to 21 in test/AndroidManifest
theMr17 Jun 22, 2024
5d966d3
Implement view models & click listeners
theMr17 Jun 23, 2024
cadf0aa
Implement sticky header & other elements
theMr17 Jun 23, 2024
3efd933
Fix test file presence check
theMr17 Jun 23, 2024
aef1d52
Add component colors
theMr17 Jun 23, 2024
eab99ff
Add missing kdoc comments
theMr17 Jun 23, 2024
4554beb
Fix ktlint issue
theMr17 Jun 23, 2024
85e89f2
Fix ktlint issue
theMr17 Jun 23, 2024
8b902eb
Remove empty classroom from the list
theMr17 Jun 23, 2024
74c29af
Merge branch 'develop' into multiple-classrooms-model-support
theMr17 Jun 23, 2024
ff884f1
Merge remote-tracking branch 'upstream/multiple-classrooms-model-supp…
theMr17 Jun 23, 2024
278ec66
Merge remote-tracking branch 'upstream/multiple-classrooms-domain-sup…
theMr17 Jun 23, 2024
0264c8e
Add classroom icons
theMr17 Jun 23, 2024
a4943ce
Capitalize text using MachineLocale
theMr17 Jun 23, 2024
987929d
Fix minor warnings
theMr17 Jun 23, 2024
738a0d4
Fix ktlint check
theMr17 Jun 24, 2024
d710a5f
Add InitializationProvider to app/AndroidManifest
theMr17 Jun 24, 2024
482a52d
Bump minSdkVersion to 21 in testing/test/AndroidManifest
theMr17 Jun 24, 2024
91a1ca2
Bump minSdkVersion to 21 in domain/test/AndroidManifest
theMr17 Jun 24, 2024
2e3d2f0
Merge branch 'develop' into multiple-classrooms-domain-support
theMr17 Jun 24, 2024
3f02092
Fix classroom filtering logic for textproto
theMr17 Jun 24, 2024
5e3979c
Merge branch 'multiple-classrooms-domain-support' into multiple-class…
theMr17 Jun 24, 2024
05b01b4
Save and fetch classroomId from profile
theMr17 Jun 24, 2024
3102ed1
Fix static checks
theMr17 Jun 24, 2024
1c75e74
Pass ProfileId object instead of internalProfileId
theMr17 Jun 24, 2024
3662da9
Fix ktlint check
theMr17 Jun 24, 2024
fd5b255
Fix failing tests related to ProfileId
theMr17 Jun 24, 2024
8779e93
Highlight selected classroom card
theMr17 Jun 24, 2024
c5f1764
Add dummy tests
theMr17 Jun 25, 2024
66ad0ef
Revert "Add dummy tests"
theMr17 Jun 25, 2024
a7521db
Add compose test dependencies
theMr17 Jun 25, 2024
6c8b8d1
Add tests
theMr17 Jun 25, 2024
586cb1a
Add missing references
theMr17 Jun 25, 2024
045a2e3
Add compose test dependencies on Bazel
theMr17 Jun 25, 2024
75a952b
Add missing kdoc
theMr17 Jun 25, 2024
6b369b6
Introduce androidx.text.ext:truth dependency to data, domain & testin…
theMr17 Jun 26, 2024
a251759
Bump minSdkVersion to 21 for utility module
theMr17 Jun 26, 2024
624b627
Remove data tests targeting KitKat (API level 19)
theMr17 Jun 26, 2024
9c80a4f
Add test to verify sticky header
theMr17 Jun 26, 2024
1da3d6b
Fix ktlint check
theMr17 Jun 26, 2024
c3dc10e
Update the classroom icons
theMr17 Jun 26, 2024
3b41814
Merge branch 'develop' into multiple-classrooms-ui-support
theMr17 Jun 26, 2024
4157408
Merge branch 'develop' into multiple-classrooms-ui-support
theMr17 Jun 26, 2024
0c89a9b
Add tests
theMr17 Jun 26, 2024
78c75bb
Add tests
theMr17 Jun 26, 2024
33dbb0a
Modify comment in color files
theMr17 Jun 26, 2024
cf88291
Rename classrooms string
theMr17 Jun 26, 2024
018b0a0
Update classroom click listener kdoc
theMr17 Jun 26, 2024
c0ee6bc
Update test names
theMr17 Jun 26, 2024
792afd8
Surround with null check instead of assertion
theMr17 Jun 26, 2024
00a550f
Remove duplicate galleryIntent code
theMr17 Jun 26, 2024
6cbedcf
Improve readability of gating logic
theMr17 Jun 26, 2024
dca259e
Fix test names
theMr17 Jun 26, 2024
e5251a2
Remove onActivity after pressBack in tests
theMr17 Jun 26, 2024
952a0aa
Introduce class variable for profileId
theMr17 Jun 27, 2024
298db4f
Make classroom list fragment tag to be private
theMr17 Jun 27, 2024
81bf236
Fix ktlint issue
theMr17 Jun 27, 2024
70119f2
Add tests
theMr17 Jun 27, 2024
2cae24e
Add tests
theMr17 Jun 27, 2024
8a868fc
Add tests
theMr17 Jun 27, 2024
8768030
Update TopicCard composable
theMr17 Jun 27, 2024
41f772b
Update data flow for classroom card click
theMr17 Jun 27, 2024
702b5b7
Fix ktlint check
theMr17 Jun 27, 2024
f334bbb
Fix static checks
theMr17 Jun 27, 2024
5de9e27
Add tests
theMr17 Jun 27, 2024
9d7c47a
Update all topics header test tag comment
theMr17 Jun 28, 2024
10cae14
Update promoted list and card
theMr17 Jun 28, 2024
ceba84b
Fix isNotNullOrEmpty logic
theMr17 Jun 28, 2024
2f1e30f
Fix tests
theMr17 Jun 28, 2024
797799c
Fix static checks
theMr17 Jun 28, 2024
fa06e4b
Update & remove empty tests
theMr17 Jun 28, 2024
7e58ef5
Move all dp/sp of PromotedList to dimens.
theMr17 Jun 28, 2024
b883077
Move all dp/sp of ClassroomList to dimens.
theMr17 Jun 28, 2024
46b076c
Move all dp/sp of AllTopicsHeaderText to dimens.
theMr17 Jun 28, 2024
b2801f4
Move all dp/sp of TopicCard to dimens.
theMr17 Jun 28, 2024
8befc1a
Move all dp/sp of WelcomeText to dimens.
theMr17 Jun 28, 2024
815e634
Move all elevations to dimens.
theMr17 Jun 28, 2024
e76e0d6
Fix test setup
theMr17 Jun 28, 2024
3cf5410
Fix ktlint check
theMr17 Jun 28, 2024
5697e67
Merge branch 'develop' into multiple-classrooms-ui-support
adhiamboperes Jun 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ package_group(
{
"flavor": "oppia_kitkat",
"main_dex_list": "//:config/kitkat_main_dex_class_list.txt",
"min_sdk_version": 19,
"min_sdk_version": 21,
"multidex": "manual_main_dex",
"target_sdk_version": 33,
},
Expand Down
17 changes: 15 additions & 2 deletions app/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,7 @@ android_library(
"//model/src/main/proto:thumbnail_java_proto_lite",
"//model/src/main/proto:version_java_proto_lite",
"//third_party:androidx_annotation_annotation",
"//third_party:androidx_compose_ui_ui",
"//third_party:androidx_constraintlayout_constraintlayout",
"//third_party:androidx_core_core",
"//third_party:androidx_databinding_databinding-adapters",
Expand Down Expand Up @@ -763,6 +764,7 @@ kt_android_library(
custom_package = "org.oppia.android.app.ui",
enable_data_binding = 1,
manifest = "src/main/AppAndroidManifest.xml",
plugins = ["//tools/kotlin:jetpack_compose_compiler_plugin"],
visibility = ["//visibility:public"],
deps = [
":binding_adapters",
Expand All @@ -787,6 +789,15 @@ kt_android_library(
"//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_activity_activity-compose",
"//third_party:androidx_annotation_annotation",
"//third_party:androidx_appcompat_appcompat",
"//third_party:androidx_compose_foundation_foundation",
"//third_party:androidx_compose_foundation_foundation-layout",
"//third_party:androidx_compose_material_material",
"//third_party:androidx_compose_runtime_runtime",
"//third_party:androidx_compose_ui_ui",
"//third_party:androidx_core_core-ktx",
"//third_party:androidx_databinding_databinding-adapters",
"//third_party:androidx_databinding_databinding-common",
"//third_party:androidx_databinding_databinding-runtime",
Expand All @@ -800,6 +811,7 @@ kt_android_library(
"//third_party:com_github_takusemba_spotlight",
"//third_party:com_google_android_flexbox_flexbox",
"//third_party:javax_annotation_javax_annotation-api_jar",
"//third_party:org_jetbrains_kotlin_kotlin-stdlib-jdk8_jar",
"//utility",
"//utility/src/main/java/org/oppia/android/util/extensions:bundle_extensions",
"//utility/src/main/java/org/oppia/android/util/parser/image:image_loader",
Expand Down Expand Up @@ -898,6 +910,7 @@ TEST_DEPS = [
"//testing/src/main/java/org/oppia/android/testing/threading:test_module",
"//testing/src/main/java/org/oppia/android/testing/time:test_module",
"//third_party:androidx_annotation_annotation",
"//third_party:androidx_compose_ui_ui-test-junit4",
"//third_party:androidx_core_core",
"//third_party:androidx_databinding_databinding-adapters",
"//third_party:androidx_databinding_databinding-common",
Expand Down Expand Up @@ -956,7 +969,7 @@ MIGRATED_TESTS = [
filtered_tests = MIGRATED_TESTS,
manifest_values = {
"applicationId": "org.oppia.android",
"minSdkVersion": "19",
"minSdkVersion": "21",
"targetSdkVersion": "30",
"versionCode": "0",
"versionName": "0.1-alpha",
Expand All @@ -972,7 +985,7 @@ MIGRATED_TESTS = [
filtered_tests = MIGRATED_TESTS,
manifest_values = {
"applicationId": "org.oppia.android",
"minSdkVersion": "19",
"minSdkVersion": "21",
"targetSdkVersion": "30",
"versionCode": "0",
"versionName": "0.1-alpha",
Expand Down
23 changes: 21 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ apply plugin: 'kotlin-kapt'

android {
compileSdkVersion 33
buildToolsVersion "29.0.2"
buildToolsVersion "30.0.2"
adhiamboperes marked this conversation as resolved.
Show resolved Hide resolved
defaultConfig {
applicationId "org.oppia.android"
minSdkVersion 19
minSdkVersion 21
targetSdkVersion 33
versionCode 1
versionName "1.0"
Expand All @@ -30,6 +30,15 @@ android {
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
useIR = true
freeCompilerArgs += ["-opt-in=kotlin.RequiresOptIn"]
}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion compose_version
kotlinCompilerVersion kotlin_version
}
buildTypes {
release {
Expand Down Expand Up @@ -147,6 +156,13 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation(
'androidx.appcompat:appcompat:1.0.2',
"androidx.compose.foundation:foundation:$compose_version",
"androidx.compose.foundation:foundation-layout:$compose_version",
"androidx.compose.material:material:$compose_version",
"androidx.compose.runtime:runtime:$compose_version",
"androidx.compose.runtime:runtime-livedata:$compose_version",
"androidx.compose.ui:ui:$compose_version",
"androidx.compose.ui:ui-tooling:$compose_version",
'androidx.constraintlayout:constraintlayout:1.1.3',
'androidx.core:core-ktx:1.0.2',
'androidx.legacy:legacy-support-v4:1.0.0',
Expand All @@ -164,6 +180,7 @@ dependencies {
'com.github.bumptech.glide:glide:4.11.0',
'com.google.android.flexbox:flexbox:3.0.0',
'com.google.android.material:material:1.3.0',
"com.google.android.material:compose-theme-adapter:$compose_version",
'com.google.dagger:dagger:2.41',
'com.google.firebase:firebase-analytics:17.5.0',
'com.google.firebase:firebase-analytics-ktx:17.5.0',
Expand All @@ -189,6 +206,7 @@ dependencies {
'org.glassfish.jaxb:jaxb-runtime:2.3.2',
)
testImplementation(
"androidx.compose.ui:ui-test-junit4:$compose_version",
'androidx.test:core:1.2.0',
'androidx.test.espresso:espresso-contrib:3.1.0',
'androidx.test.espresso:espresso-core:3.2.0',
Expand All @@ -207,6 +225,7 @@ dependencies {
project(":testing"),
)
androidTestImplementation(
"androidx.compose.ui:ui-test-junit4:$compose_version",
'androidx.test:core:1.2.0',
'androidx.test.espresso:espresso-contrib:3.1.0',
'androidx.test.espresso:espresso-core:3.2.0',
Expand Down
8 changes: 8 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -332,11 +332,19 @@
<activity
android:name=".app.testing.ColorBindingAdaptersTestActivity"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.classroom.ClassroomListActivity"
android:label="@string/classroom_list_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar" />

<provider
android:name="androidx.work.impl.WorkManagerInitializer"
android:authorities="${applicationId}.workmanager-init"
android:exported="false"
tools:node="remove" />
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
tools:node="remove" />
</application>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import dagger.Subcomponent
import org.oppia.android.app.administratorcontrols.AdministratorControlsActivity
import org.oppia.android.app.administratorcontrols.appversion.AppVersionActivity
import org.oppia.android.app.administratorcontrols.learneranalytics.ProfileAndDeviceIdActivity
import org.oppia.android.app.classroom.ClassroomListActivity
import org.oppia.android.app.completedstorylist.CompletedStoryListActivity
import org.oppia.android.app.devoptions.DeveloperOptionsActivity
import org.oppia.android.app.devoptions.forcenetworktype.ForceNetworkTypeActivity
Expand Down Expand Up @@ -218,4 +219,5 @@ interface ActivityComponentImpl :
fun inject(walkthroughActivity: WalkthroughActivity)
fun inject(surveyActivity: SurveyActivity)
fun inject(colorBindingAdaptersTestActivity: ColorBindingAdaptersTestActivity)
fun inject(classroomListActivity: ClassroomListActivity)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
package org.oppia.android.app.classroom

import android.content.Context
import android.content.Intent
import android.os.Bundle
import org.oppia.android.R
import org.oppia.android.app.activity.ActivityComponentImpl
import org.oppia.android.app.activity.InjectableAutoLocalizedAppCompatActivity
import org.oppia.android.app.activity.route.ActivityRouter
import org.oppia.android.app.drawer.ExitProfileDialogFragment
import org.oppia.android.app.drawer.TAG_SWITCH_PROFILE_DIALOG
import org.oppia.android.app.home.RouteToRecentlyPlayedListener
import org.oppia.android.app.home.RouteToTopicListener
import org.oppia.android.app.home.RouteToTopicPlayStoryListener
import org.oppia.android.app.model.DestinationScreen
import org.oppia.android.app.model.ExitProfileDialogArguments
import org.oppia.android.app.model.HighlightItem
import org.oppia.android.app.model.ProfileId
import org.oppia.android.app.model.RecentlyPlayedActivityParams
import org.oppia.android.app.model.RecentlyPlayedActivityTitle
import org.oppia.android.app.model.ScreenName.CLASSROOM_LIST_ACTIVITY
import org.oppia.android.app.topic.TopicActivity
import org.oppia.android.app.translation.AppLanguageResourceHandler
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

/** The activity for displaying [ClassroomListFragment]. */
class ClassroomListActivity :
InjectableAutoLocalizedAppCompatActivity(),
RouteToTopicListener,
RouteToTopicPlayStoryListener,
RouteToRecentlyPlayedListener {
@Inject
lateinit var classroomListActivityPresenter: ClassroomListActivityPresenter

@Inject
lateinit var resourceHandler: AppLanguageResourceHandler

@Inject
lateinit var activityRouter: ActivityRouter

private var internalProfileId: Int = -1

companion object {
/** Returns a new [Intent] to route to [ClassroomListActivity] for a specified [profileId]. */
fun createClassroomListActivity(context: Context, profileId: ProfileId?): Intent {
return Intent(context, ClassroomListActivity::class.java).apply {
decorateWithScreenName(CLASSROOM_LIST_ACTIVITY)
profileId?.let { decorateWithUserProfileId(profileId) }
}
}
}

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

internalProfileId = intent.extractCurrentUserProfileId().internalId
classroomListActivityPresenter.handleOnCreate()
title = resourceHandler.getStringInLocale(R.string.classroom_list_activity_title)
}

override fun onRestart() {
super.onRestart()
classroomListActivityPresenter.handleOnRestart()
}

override fun onBackPressed() {
val previousFragment =
supportFragmentManager.findFragmentByTag(TAG_SWITCH_PROFILE_DIALOG)
if (previousFragment != null) {
supportFragmentManager.beginTransaction().remove(previousFragment).commitNow()
}
val exitProfileDialogArguments =
ExitProfileDialogArguments
.newBuilder()
.setHighlightItem(HighlightItem.NONE)
.build()
val dialogFragment = ExitProfileDialogFragment
.newInstance(exitProfileDialogArguments = exitProfileDialogArguments)
dialogFragment.showNow(supportFragmentManager, TAG_SWITCH_PROFILE_DIALOG)
}

override fun routeToRecentlyPlayed(recentlyPlayedActivityTitle: RecentlyPlayedActivityTitle) {
val recentlyPlayedActivityParams =
RecentlyPlayedActivityParams
.newBuilder()
.setProfileId(ProfileId.newBuilder().setInternalId(internalProfileId).build())
.setActivityTitle(recentlyPlayedActivityTitle).build()

activityRouter.routeToScreen(
DestinationScreen
.newBuilder()
.setRecentlyPlayedActivityParams(recentlyPlayedActivityParams)
.build()
)
}

override fun routeToTopic(internalProfileId: Int, topicId: String) {
startActivity(TopicActivity.createTopicActivityIntent(this, internalProfileId, topicId))
}

override fun routeToTopicPlayStory(internalProfileId: Int, topicId: String, storyId: String) {
startActivity(
TopicActivity.createTopicPlayStoryActivityIntent(
this,
internalProfileId,
topicId,
storyId
)
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package org.oppia.android.app.classroom

import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar
import androidx.drawerlayout.widget.DrawerLayout
import org.oppia.android.R
import org.oppia.android.app.drawer.NavigationDrawerFragment
import javax.inject.Inject

/** Tag for identifying the [ClassroomListFragment] in transactions. */
private const val TAG_CLASSROOM_LIST_FRAGMENT = "CLASSROOM_LIST_FRAGMENT"

/** The presenter for [ClassroomListActivity]. */
class ClassroomListActivityPresenter @Inject constructor(private val activity: AppCompatActivity) {
private var navigationDrawerFragment: NavigationDrawerFragment? = null

/**
* Handles the creation of the activity. Sets the content view, sets up the navigation drawer,
* and adds the [ClassroomListFragment] if it's not already added.
*/
fun handleOnCreate() {
activity.setContentView(R.layout.classroom_list_activity)
setUpNavigationDrawer()
if (getClassroomListFragment() == null) {
activity.supportFragmentManager.beginTransaction().add(
R.id.classroom_list_fragment_placeholder,
ClassroomListFragment(),
TAG_CLASSROOM_LIST_FRAGMENT
).commitNow()
}
}

/** Handles the activity restart. Re-initializes the navigation drawer. */
fun handleOnRestart() {
setUpNavigationDrawer()
}

private fun setUpNavigationDrawer() {
val toolbar = activity.findViewById<View>(R.id.classroom_list_activity_toolbar) as Toolbar
activity.setSupportActionBar(toolbar)
activity.supportActionBar!!.setDisplayShowHomeEnabled(true)
navigationDrawerFragment = activity
.supportFragmentManager
.findFragmentById(
R.id.classroom_list_activity_fragment_navigation_drawer
) as NavigationDrawerFragment
navigationDrawerFragment!!.setUpDrawer(
activity.findViewById<View>(R.id.classroom_list_activity_drawer_layout) as DrawerLayout,
toolbar, R.id.nav_home
)
}

private fun getClassroomListFragment(): ClassroomListFragment? {
return activity.supportFragmentManager.findFragmentById(
R.id.classroom_list_fragment_placeholder
) as ClassroomListFragment?
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package org.oppia.android.app.classroom

import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import org.oppia.android.app.fragment.FragmentComponentImpl
import org.oppia.android.app.fragment.InjectableFragment
import org.oppia.android.app.home.classroomlist.ClassroomSummaryClickListener
import org.oppia.android.app.home.topiclist.TopicSummaryClickListener
import org.oppia.android.app.model.ClassroomSummary
import org.oppia.android.app.model.TopicSummary
import javax.inject.Inject

/** Fragment that displays the classroom list screen. */
class ClassroomListFragment :
InjectableFragment(),
TopicSummaryClickListener,
ClassroomSummaryClickListener {
@Inject
lateinit var classroomListFragmentPresenter: ClassroomListFragmentPresenter

override fun onAttach(context: Context) {
super.onAttach(context)
(fragmentComponent as FragmentComponentImpl).inject(this)
}

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return classroomListFragmentPresenter.handleCreateView(inflater, container)
}

override fun onTopicSummaryClicked(topicSummary: TopicSummary) {
classroomListFragmentPresenter.onTopicSummaryClicked(topicSummary)
}
adhiamboperes marked this conversation as resolved.
Show resolved Hide resolved

override fun onClassroomSummaryClicked(classroomSummary: ClassroomSummary) {
classroomListFragmentPresenter.onClassroomSummaryClicked(classroomSummary)
}
}
Loading
Loading