Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/oppia/oppia-android into o…
Browse files Browse the repository at this point in the history
…ppia#4419

� Conflicts:
�	scripts/assets/test_file_exemptions.textproto
�	version.bzl
  • Loading branch information
XichengSpencer committed Jun 30, 2024
2 parents caebae1 + 103f5a8 commit 0e939f6
Show file tree
Hide file tree
Showing 268 changed files with 17,678 additions and 2,632 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ bazel-*
.bazelproject
.aswb
*.pb
coverage_reports
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
21 changes: 18 additions & 3 deletions app/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,9 @@ VIEWS_WITH_RESOURCE_IMPORTS = [
"src/main/java/org/oppia/android/app/customview/ChapterNotStartedContainerConstraintLayout.kt",
"src/main/java/org/oppia/android/app/customview/ContinueButtonView.kt",
"src/main/java/org/oppia/android/app/customview/LessonThumbnailImageView.kt",
"src/main/java/org/oppia/android/app/customview/OppiaCurveBackgroundView.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",
Expand Down Expand Up @@ -485,6 +485,7 @@ BINDING_ADAPTERS_WITH_RESOURCE_IMPORTS = [
BINDING_ADAPTERS = [
"src/main/java/org/oppia/android/app/databinding/AppCompatCheckBoxBindingAdapters.java",
"src/main/java/org/oppia/android/app/databinding/CircularProgressIndicatorAdapters.java",
"src/main/java/org/oppia/android/app/databinding/ColorBindingAdapters.java",
"src/main/java/org/oppia/android/app/databinding/ConstraintLayoutAdapters.java",
"src/main/java/org/oppia/android/app/databinding/EditTextBindingAdapters.java",
"src/main/java/org/oppia/android/app/databinding/GuidelineBindingAdapters.java",
Expand Down Expand Up @@ -601,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 @@ -762,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 @@ -786,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 @@ -799,10 +811,12 @@ 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",
"//utility/src/main/java/org/oppia/android/util/parser/image:image_parsing_annonations",
"//utility/src/main/java/org/oppia/android/util/profile:current_user_profile_id_intent_decorator",
"//utility/src/main/java/org/oppia/android/util/statusbar:status_bar_color",
],
)
Expand Down Expand Up @@ -896,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 @@ -954,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 @@ -970,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
24 changes: 21 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

android {
compileSdkVersion 33
buildToolsVersion "29.0.2"
buildToolsVersion "30.0.2"
defaultConfig {
applicationId "org.oppia.android"
minSdkVersion 19
minSdkVersion 21
targetSdkVersion 33
versionCode 1
versionName "1.0"
Expand All @@ -31,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 @@ -148,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 @@ -165,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 @@ -190,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 @@ -208,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
11 changes: 11 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -329,11 +329,22 @@
android:label="@string/survey_activity_title"
android:theme="@style/OppiaThemeWithoutActionBar"
android:windowSoftInputMode="adjustNothing" />
<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 @@ -59,6 +60,7 @@ import org.oppia.android.app.testing.AdministratorControlsFragmentTestActivity
import org.oppia.android.app.testing.AppCompatCheckBoxBindingAdaptersTestActivity
import org.oppia.android.app.testing.AudioFragmentTestActivity
import org.oppia.android.app.testing.CircularProgressIndicatorAdaptersTestActivity
import org.oppia.android.app.testing.ColorBindingAdaptersTestActivity
import org.oppia.android.app.testing.ConceptCardFragmentTestActivity
import org.oppia.android.app.testing.DragDropTestActivity
import org.oppia.android.app.testing.DrawableBindingAdaptersTestActivity
Expand Down Expand Up @@ -216,4 +218,6 @@ interface ActivityComponentImpl :
fun inject(viewEventLogsTestActivity: ViewEventLogsTestActivity)
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
Expand Up @@ -8,43 +8,33 @@ import org.oppia.android.app.activity.ActivityComponentImpl
import org.oppia.android.app.activity.InjectableAutoLocalizedAppCompatActivity
import org.oppia.android.app.administratorcontrols.appversion.AppVersionActivity
import org.oppia.android.app.administratorcontrols.learneranalytics.ProfileAndDeviceIdActivity
import org.oppia.android.app.drawer.NAVIGATION_PROFILE_ID_ARGUMENT_KEY
import org.oppia.android.app.model.AdministratorControlActivityStateBundle
import org.oppia.android.app.model.ProfileId
import org.oppia.android.app.model.ScreenName.ADMINISTRATOR_CONTROLS_ACTIVITY
import org.oppia.android.app.settings.profile.ProfileEditFragment
import org.oppia.android.app.settings.profile.ProfileListActivity
import org.oppia.android.app.settings.profile.ProfileListFragment
import org.oppia.android.app.translation.AppLanguageResourceHandler
import org.oppia.android.util.extensions.getStringFromBundle
import org.oppia.android.util.extensions.getProto
import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.decorateWithScreenName
import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.decorateWithUserProfileId
import javax.inject.Inject

/** Argument key for of title for selected controls in [AdministratorControlsActivity]. */
const val SELECTED_CONTROLS_TITLE_SAVED_KEY =
"AdministratorControlsActivity.selected_controls_title"

/** Argument key for of selected profile for selected controls in [AdministratorControlsActivity]. */
const val SELECTED_PROFILE_ID_SAVED_KEY =
"AdministratorControlsActivity.selected_profile_id"

/** Argument key for last loaded fragment in [AdministratorControlsActivity]. */
const val LAST_LOADED_FRAGMENT_EXTRA_KEY = "AdministratorControlsActivity.last_loaded_fragment"

/** Argument key used to identify [ProfileListFragment] in the backstack. */
const val PROFILE_LIST_FRAGMENT = "PROFILE_LIST_FRAGMENT"

/** Argument key used to identify [ProfileEditFragment] in the backstack. */
const val PROFILE_EDIT_FRAGMENT = "PROFILE_EDIT_FRAGMENT"

/** Argument key for the Profile deletion confirmation in [ProfileEditActivity]. */
const val IS_PROFILE_DELETION_DIALOG_VISIBLE_KEY =
"ProfileEditActivity.is_profile_deletion_dialog_visible"

/** Argument key used to identify [AppVersionFragment] in the backstack. */
const val APP_VERSION_FRAGMENT = "APP_VERSION_FRAGMENT"

/** Argument key used to identify [ProfileAndDeviceIdFragment] in the backstack. */
const val PROFILE_AND_DEVICE_ID_FRAGMENT = "PROFILE_AND_DEVICE_ID_FRAGMENT"

/** Argument key for Administrator Controls Activity saved state. */
const val ADMINISTRATOR_CONTROLS_ACTIVITY_STATE_KEY = "ADMINISTRATOR_CONTROLS_ACTIVITY_STATE_KEY"

/** Activity [AdministratorControlsActivity] that allows user to change admin controls. */
class AdministratorControlsActivity :
InjectableAutoLocalizedAppCompatActivity(),
Expand All @@ -68,17 +58,24 @@ class AdministratorControlsActivity :
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
(activityComponent as ActivityComponentImpl).inject(this)
val extraControlsTitle =
savedInstanceState?.getStringFromBundle(SELECTED_CONTROLS_TITLE_SAVED_KEY)

val args = savedInstanceState?.getProto(
ADMINISTRATOR_CONTROLS_ACTIVITY_STATE_KEY,
AdministratorControlActivityStateBundle.getDefaultInstance()
)

val extraControlsTitle = args?.selectedControlsTitle

isProfileDeletionDialogVisible =
savedInstanceState?.getBoolean(IS_PROFILE_DELETION_DIALOG_VISIBLE_KEY) ?: false
args?.isProfileDeletionDialogVisible ?: false
lastLoadedFragment = if (savedInstanceState != null) {
savedInstanceState.getStringFromBundle(LAST_LOADED_FRAGMENT_EXTRA_KEY) as String
args?.lastLoadedFragment as String
} else {
// 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 = savedInstanceState?.getInt(SELECTED_PROFILE_ID_SAVED_KEY) ?: -1
val selectedProfileId = args?.selectedProfileId ?: -1

administratorControlsActivityPresenter.handleOnCreate(
extraControlsTitle,
lastLoadedFragment,
Expand Down Expand Up @@ -111,18 +108,17 @@ class AdministratorControlsActivity :
}

companion object {

/** Returns an [Intent] to start this activity. */
fun createAdministratorControlsActivityIntent(context: Context, profileId: Int?): Intent {
fun createAdministratorControlsActivityIntent(context: Context, profileId: ProfileId?): Intent {

val intent = Intent(context, AdministratorControlsActivity::class.java)
intent.putExtra(NAVIGATION_PROFILE_ID_ARGUMENT_KEY, profileId)
intent.decorateWithScreenName(ADMINISTRATOR_CONTROLS_ACTIVITY)
if (profileId != null) {
intent.decorateWithUserProfileId(profileId)
}
return intent
}

/** Returns the argument key used to specify the user's internal profile ID. */
fun getIntentKey(): String {
return NAVIGATION_PROFILE_ID_ARGUMENT_KEY
}
}

override fun onBackPressed() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ import org.oppia.android.app.activity.ActivityScope
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.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 javax.inject.Inject

/** The presenter for [AdministratorControlsActivity]. */
Expand Down Expand Up @@ -198,13 +200,18 @@ class AdministratorControlsActivityPresenter @Inject constructor(
/** Saves the state of the views on configuration changes. */
fun handleOnSaveInstanceState(outState: Bundle) {
val titleTextView = binding.extraControlsTitle
if (titleTextView != null) {
outState.putString(SELECTED_CONTROLS_TITLE_SAVED_KEY, titleTextView.text.toString())
}
outState.putString(LAST_LOADED_FRAGMENT_EXTRA_KEY, lastLoadedFragment)
isProfileDeletionDialogVisible.let {
outState.putBoolean(IS_PROFILE_DELETION_DIALOG_VISIBLE_KEY, it)
}
selectedProfileId.let { outState.putInt(SELECTED_PROFILE_ID_SAVED_KEY, it) }
val args = AdministratorControlActivityStateBundle.newBuilder()
.apply {
if (titleTextView != null) {
selectedControlsTitle = titleTextView.text.toString()
}
lastLoadedFragment = this@AdministratorControlsActivityPresenter.lastLoadedFragment
this@AdministratorControlsActivityPresenter.isProfileDeletionDialogVisible.let {
isProfileDeletionDialogVisible = it
}
selectedProfileId = this@AdministratorControlsActivityPresenter.selectedProfileId
}
.build()
outState.putProto(ADMINISTRATOR_CONTROLS_ACTIVITY_STATE_KEY, args)
}
}
Loading

0 comments on commit 0e939f6

Please sign in to comment.