From 97a08d7a9394864c9c9d18e4f9786a513c2460bd Mon Sep 17 00:00:00 2001 From: Adhiambo Peres <59600948+adhiamboperes@users.noreply.github.com> Date: Tue, 21 May 2024 17:09:12 +0300 Subject: [PATCH 1/5] Setup compose on kt 1.6 --- app/BUILD.bazel | 14 + .../android/app/home/HomeFragmentPresenter.kt | 37 ++ .../android/app/options/OptionsActivity.kt | 51 +- app/src/main/res/layout/home_fragment.xml | 6 + third_party/maven_install.json | 490 +++++++++++++++++- third_party/versions.bzl | 7 + tools/kotlin/BUILD.bazel | 15 +- 7 files changed, 568 insertions(+), 52 deletions(-) diff --git a/app/BUILD.bazel b/app/BUILD.bazel index 4a81d2701f9..941f50cad87 100644 --- a/app/BUILD.bazel +++ b/app/BUILD.bazel @@ -601,6 +601,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", @@ -767,6 +768,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", @@ -791,6 +793,16 @@ 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_core_core-ktx", + "//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_concurrent_concurrent-futures", "//third_party:androidx_databinding_databinding-adapters", "//third_party:androidx_databinding_databinding-common", "//third_party:androidx_databinding_databinding-runtime", @@ -803,6 +815,8 @@ kt_android_library( "//third_party:com_caverock_androidsvg", "//third_party:com_github_takusemba_spotlight", "//third_party:com_google_android_flexbox_flexbox", + "//third_party:com_google_guava_listenablefuture", + "//third_party:org_jetbrains_kotlin_kotlin-stdlib-jdk8_jar", "//third_party:javax_annotation_javax_annotation-api_jar", "//utility", "//utility/src/main/java/org/oppia/android/util/extensions:bundle_extensions", diff --git a/app/src/main/java/org/oppia/android/app/home/HomeFragmentPresenter.kt b/app/src/main/java/org/oppia/android/app/home/HomeFragmentPresenter.kt index eedc0483a0b..dfa93956447 100644 --- a/app/src/main/java/org/oppia/android/app/home/HomeFragmentPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/home/HomeFragmentPresenter.kt @@ -4,6 +4,14 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.appcompat.app.AppCompatActivity +import androidx.compose.foundation.ExperimentalFoundationApi +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.material.ExperimentalMaterialApi +import androidx.compose.material.MaterialTheme +import androidx.compose.material.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.platform.ViewCompositionStrategy +import androidx.compose.ui.unit.ExperimentalUnitApi import androidx.fragment.app.Fragment import androidx.recyclerview.widget.GridLayoutManager import org.oppia.android.R @@ -96,9 +104,38 @@ class HomeFragmentPresenter @Inject constructor( it.viewModel = homeViewModel } + binding.composeView.apply { + setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed) + setContent { + MaterialTheme { + GroupedList() + } + } + } + return binding.root } + @OptIn( + ExperimentalFoundationApi::class, + ExperimentalUnitApi::class, + ExperimentalMaterialApi::class + ) + @Composable + fun GroupedList() { + val sections = listOf("A", "B", "C") + + LazyColumn { + sections.forEach { + stickyHeader { + } + items(10) { item -> + Text(text = "Some item $item") + } + } + } + } + private fun createRecyclerViewAdapter(): BindableAdapter { return multiTypeBuilderFactory.create { viewModel -> when (viewModel) { diff --git a/app/src/main/java/org/oppia/android/app/options/OptionsActivity.kt b/app/src/main/java/org/oppia/android/app/options/OptionsActivity.kt index 874f0bb5916..5ee52ddc710 100644 --- a/app/src/main/java/org/oppia/android/app/options/OptionsActivity.kt +++ b/app/src/main/java/org/oppia/android/app/options/OptionsActivity.kt @@ -1,9 +1,12 @@ package org.oppia.android.app.options +import android.app.Activity import android.content.Context import android.content.Intent import android.os.Bundle import android.widget.TextView +import androidx.activity.result.ActivityResultLauncher +import androidx.activity.result.contract.ActivityResultContracts import org.oppia.android.R import org.oppia.android.app.activity.ActivityComponentImpl import org.oppia.android.app.activity.InjectableAutoLocalizedAppCompatActivity @@ -49,6 +52,9 @@ class OptionsActivity : private lateinit var selectedFragment: String private var profileId: Int? = -1 + private lateinit var audioLanguageResultLauncher: ActivityResultLauncher + private lateinit var textSizeResultLauncher: ActivityResultLauncher + companion object { // TODO(#1655): Re-restrict access to fields in tests post-Gradle. /** [Boolean] indicating whether user is navigating from Drawer. */ @@ -96,26 +102,29 @@ class OptionsActivity : profileId!! ) title = resourceHandler.getStringInLocale(R.string.menu_options) - } - override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { - super.onActivityResult(requestCode, resultCode, data) - checkNotNull(data) { - "Expected data to be passed as an activity result for request: $requestCode." + audioLanguageResultLauncher = registerForActivityResult( + ActivityResultContracts.StartActivityForResult() + ) { result -> + if (result.resultCode == Activity.RESULT_OK) { + val data: Intent? = result.data + val audioLanguage = data?.getProtoExtra( + MESSAGE_AUDIO_LANGUAGE_RESULTS_KEY, AudioLanguageActivityResultBundle.getDefaultInstance() + )?.audioLanguage + optionActivityPresenter.updateAudioLanguage(audioLanguage!!) + } } - when (requestCode) { - REQUEST_CODE_TEXT_SIZE -> { - val textSizeResults = data.getProtoExtra( + + textSizeResultLauncher = registerForActivityResult( + ActivityResultContracts.StartActivityForResult() + ) { result -> + if (result.resultCode == Activity.RESULT_OK) { + val data: Intent? = result.data + val textSizeResults = data?.getProtoExtra( MESSAGE_READING_TEXT_SIZE_RESULTS_KEY, ReadingTextSizeActivityResultBundle.getDefaultInstance() ) - optionActivityPresenter.updateReadingTextSize(textSizeResults.selectedReadingTextSize) - } - REQUEST_CODE_AUDIO_LANGUAGE -> { - val audioLanguage = data.getProtoExtra( - MESSAGE_AUDIO_LANGUAGE_RESULTS_KEY, AudioLanguageActivityResultBundle.getDefaultInstance() - ).audioLanguage - optionActivityPresenter.updateAudioLanguage(audioLanguage) + optionActivityPresenter.updateReadingTextSize(textSizeResults!!.selectedReadingTextSize!!) } } } @@ -131,17 +140,13 @@ class OptionsActivity : } override fun routeAudioLanguageList(audioLanguage: AudioLanguage) { - startActivityForResult( - AudioLanguageActivity.createAudioLanguageActivityIntent(this, audioLanguage), - REQUEST_CODE_AUDIO_LANGUAGE - ) + val intent = AudioLanguageActivity.createAudioLanguageActivityIntent(this, audioLanguage) + audioLanguageResultLauncher.launch(intent) } override fun routeReadingTextSize(readingTextSize: ReadingTextSize) { - startActivityForResult( - ReadingTextSizeActivity.createReadingTextSizeActivityIntent(this, readingTextSize), - REQUEST_CODE_TEXT_SIZE - ) + val intent = ReadingTextSizeActivity.createReadingTextSizeActivityIntent(this, readingTextSize) + textSizeResultLauncher.launch(intent) } override fun loadReadingTextSizeFragment(textSize: ReadingTextSize) { diff --git a/app/src/main/res/layout/home_fragment.xml b/app/src/main/res/layout/home_fragment.xml index d7dfe561d70..546a32fda8c 100644 --- a/app/src/main/res/layout/home_fragment.xml +++ b/app/src/main/res/layout/home_fragment.xml @@ -25,6 +25,11 @@ android:visibility="@{viewModel.isProgressBarVisible?View.VISIBLE:View.GONE}" /> + + Date: Tue, 21 May 2024 23:28:18 +0300 Subject: [PATCH 2/5] Shift to ActivityResultContracts --- .../android/app/profile/AddProfileActivity.kt | 15 +++++--- .../profile/AddProfileActivityPresenter.kt | 35 ++++++++----------- .../ProfileProgressActivity.kt | 21 +++++++---- .../ProfileProgressActivityPresenter.kt | 20 ++++------- 4 files changed, 46 insertions(+), 45 deletions(-) diff --git a/app/src/main/java/org/oppia/android/app/profile/AddProfileActivity.kt b/app/src/main/java/org/oppia/android/app/profile/AddProfileActivity.kt index 25c45ddb07f..c372b960bd2 100644 --- a/app/src/main/java/org/oppia/android/app/profile/AddProfileActivity.kt +++ b/app/src/main/java/org/oppia/android/app/profile/AddProfileActivity.kt @@ -1,8 +1,10 @@ package org.oppia.android.app.profile +import android.app.Activity import android.content.Context import android.content.Intent import android.os.Bundle +import androidx.activity.result.contract.ActivityResultContracts import org.oppia.android.app.activity.ActivityComponentImpl import org.oppia.android.app.activity.InjectableAutoLocalizedAppCompatActivity import org.oppia.android.app.model.ScreenName.ADD_PROFILE_ACTIVITY @@ -29,6 +31,14 @@ class AddProfileActivity : InjectableAutoLocalizedAppCompatActivity() { super.onCreate(savedInstanceState) (activityComponent as ActivityComponentImpl).inject(this) addProfileFragmentPresenter.handleOnCreate() + + addProfileFragmentPresenter.resultLauncher = registerForActivityResult( + ActivityResultContracts.StartActivityForResult() + ) { result -> + if (result.resultCode == Activity.RESULT_OK) { + addProfileFragmentPresenter.updateProfileAvatar(result.data) + } + } } override fun onSupportNavigateUp(): Boolean { @@ -39,11 +49,6 @@ class AddProfileActivity : InjectableAutoLocalizedAppCompatActivity() { return false } - override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { - super.onActivityResult(requestCode, resultCode, data) - addProfileFragmentPresenter.handleOnActivityResult(requestCode, resultCode, data) - } - override fun onDestroy() { super.onDestroy() addProfileFragmentPresenter.dismissAlertDialog() diff --git a/app/src/main/java/org/oppia/android/app/profile/AddProfileActivityPresenter.kt b/app/src/main/java/org/oppia/android/app/profile/AddProfileActivityPresenter.kt index d138419c68d..c1f69adc3af 100644 --- a/app/src/main/java/org/oppia/android/app/profile/AddProfileActivityPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/profile/AddProfileActivityPresenter.kt @@ -1,6 +1,5 @@ package org.oppia.android.app.profile -import android.app.Activity import android.content.Context import android.content.Intent import android.graphics.PorterDuff @@ -10,6 +9,7 @@ import android.provider.MediaStore import android.view.View import android.view.inputmethod.InputMethodManager import android.widget.ImageView +import androidx.activity.result.ActivityResultLauncher import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.widget.Toolbar @@ -34,8 +34,6 @@ import org.oppia.android.util.platformparameter.EnableDownloadsSupport import org.oppia.android.util.platformparameter.PlatformParameterValue import javax.inject.Inject -const val GALLERY_INTENT_RESULT_CODE = 1 - /** The presenter for [AddProfileActivity]. */ @ActivityScope class AddProfileActivityPresenter @Inject constructor( @@ -53,6 +51,8 @@ class AddProfileActivityPresenter @Inject constructor( private var inputtedConfirmPin = false private lateinit var alertDialog: AlertDialog + lateinit var resultLauncher: ActivityResultLauncher + fun handleOnCreate() { val binding = DataBindingUtil.setContentView( activity, @@ -181,25 +181,25 @@ class AddProfileActivityPresenter @Inject constructor( } } - fun handleOnActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { - if (requestCode == GALLERY_INTENT_RESULT_CODE && resultCode == Activity.RESULT_OK) { - data?.let { - selectedImage = data.data - Glide.with(activity) - .load(selectedImage) - .centerCrop() - .apply(RequestOptions.circleCropTransform()) - .into(uploadImageView) - } + fun updateProfileAvatar(data: Intent?) { + data?.let { + selectedImage = data.data + Glide.with(activity) + .load(selectedImage) + .centerCrop() + .apply(RequestOptions.circleCropTransform()) + .into(uploadImageView) } } private fun addButtonListeners(binding: AddProfileActivityBinding) { uploadImageView.setOnClickListener { - openGalleryIntent() + val galleryIntent = Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI) + resultLauncher.launch(galleryIntent) } binding.addProfileActivityEditUserImageView.setOnClickListener { - openGalleryIntent() + val galleryIntent = Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI) + resultLauncher.launch(galleryIntent) } binding.addProfileActivityCreateButton.setOnClickListener { @@ -241,11 +241,6 @@ class AddProfileActivityPresenter @Inject constructor( } } - private fun openGalleryIntent() { - val galleryIntent = Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI) - activity.startActivityForResult(galleryIntent, GALLERY_INTENT_RESULT_CODE) - } - private fun checkInputsAreValid(name: String, pin: String, confirmPin: String): Boolean { var failed = false if (name.isEmpty()) { diff --git a/app/src/main/java/org/oppia/android/app/profileprogress/ProfileProgressActivity.kt b/app/src/main/java/org/oppia/android/app/profileprogress/ProfileProgressActivity.kt index 934076c3729..48fa0a00e31 100644 --- a/app/src/main/java/org/oppia/android/app/profileprogress/ProfileProgressActivity.kt +++ b/app/src/main/java/org/oppia/android/app/profileprogress/ProfileProgressActivity.kt @@ -1,8 +1,11 @@ package org.oppia.android.app.profileprogress +import android.app.Activity import android.content.Context import android.content.Intent import android.os.Bundle +import androidx.activity.result.ActivityResultLauncher +import androidx.activity.result.contract.ActivityResultContracts import org.oppia.android.app.activity.ActivityComponentImpl import org.oppia.android.app.activity.InjectableAutoLocalizedAppCompatActivity import org.oppia.android.app.activity.route.ActivityRouter @@ -36,11 +39,21 @@ class ProfileProgressActivity : @Inject lateinit var resourceHandler: AppLanguageResourceHandler + private lateinit var resultLauncher: ActivityResultLauncher + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) (activityComponent as ActivityComponentImpl).inject(this) internalProfileId = intent.getIntExtra(PROFILE_ID_EXTRA_KEY, -1) profileProgressActivityPresenter.handleOnCreate(internalProfileId) + + resultLauncher = registerForActivityResult( + ActivityResultContracts.StartActivityForResult() + ) { result -> + if (result.resultCode == Activity.RESULT_OK) { + profileProgressActivityPresenter.updateProfileAvatar(result.data) + } + } } override fun routeToRecentlyPlayed(recentlyPlayedActivityTitle: RecentlyPlayedActivityTitle) { @@ -99,11 +112,7 @@ class ProfileProgressActivity : } override fun showGalleryForProfilePicture() { - profileProgressActivityPresenter.openGalleryIntent() - } - - override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { - super.onActivityResult(requestCode, resultCode, data) - profileProgressActivityPresenter.handleOnActivityResult(data) + val galleryIntent = Intent(Intent.ACTION_GET_CONTENT).apply { type = "image/*" } + resultLauncher.launch(galleryIntent) } } diff --git a/app/src/main/java/org/oppia/android/app/profileprogress/ProfileProgressActivityPresenter.kt b/app/src/main/java/org/oppia/android/app/profileprogress/ProfileProgressActivityPresenter.kt index 562e38f3d9f..836f5cfc0d5 100644 --- a/app/src/main/java/org/oppia/android/app/profileprogress/ProfileProgressActivityPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/profileprogress/ProfileProgressActivityPresenter.kt @@ -7,7 +7,6 @@ import androidx.appcompat.widget.Toolbar import org.oppia.android.R import org.oppia.android.app.activity.ActivityScope import org.oppia.android.app.model.ProfileId -import org.oppia.android.app.profile.GALLERY_INTENT_RESULT_CODE import org.oppia.android.domain.profile.ProfileManagementController import javax.inject.Inject @@ -50,18 +49,11 @@ class ProfileProgressActivityPresenter @Inject constructor( ) as ProfileProgressFragment? } - fun openGalleryIntent() { - val galleryIntent = Intent(Intent.ACTION_GET_CONTENT).apply { type = "image/*" } - activity.startActivityForResult(galleryIntent, GALLERY_INTENT_RESULT_CODE) - } - - fun handleOnActivityResult(intent: Intent?) { - intent?.let { - profileManagementController.updateProfileAvatar( - profileId, - intent.data, - /* colorRgb= */ 10710042 - ) - } + fun updateProfileAvatar(intent: Intent?) { + profileManagementController.updateProfileAvatar( + profileId, + intent?.data, + /* colorRgb= */ 10710042 + ) } } From c6ba8da4a1f80a783456fa20b0fbe07b74628c80 Mon Sep 17 00:00:00 2001 From: Ben Henning Date: Sat, 25 May 2024 21:10:44 -0700 Subject: [PATCH 3/5] Fix app/BUILD.bazel & revert extra app changes. --- app/BUILD.bazel | 6 +-- .../android/app/options/OptionsActivity.kt | 51 +++++++++---------- .../android/app/profile/AddProfileActivity.kt | 15 ++---- .../profile/AddProfileActivityPresenter.kt | 35 +++++++------ .../ProfileProgressActivity.kt | 21 +++----- .../ProfileProgressActivityPresenter.kt | 20 +++++--- 6 files changed, 70 insertions(+), 78 deletions(-) diff --git a/app/BUILD.bazel b/app/BUILD.bazel index 6ed2050d102..a0898ae39b0 100644 --- a/app/BUILD.bazel +++ b/app/BUILD.bazel @@ -791,13 +791,12 @@ kt_android_library( "//third_party:androidx_activity_activity-compose", "//third_party:androidx_annotation_annotation", "//third_party:androidx_appcompat_appcompat", - "//third_party:androidx_core_core-ktx", "//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_concurrent_concurrent-futures", + "//third_party:androidx_core_core-ktx", "//third_party:androidx_databinding_databinding-adapters", "//third_party:androidx_databinding_databinding-common", "//third_party:androidx_databinding_databinding-runtime", @@ -810,9 +809,8 @@ kt_android_library( "//third_party:com_caverock_androidsvg", "//third_party:com_github_takusemba_spotlight", "//third_party:com_google_android_flexbox_flexbox", - "//third_party:com_google_guava_listenablefuture", - "//third_party:org_jetbrains_kotlin_kotlin-stdlib-jdk8_jar", "//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", diff --git a/app/src/main/java/org/oppia/android/app/options/OptionsActivity.kt b/app/src/main/java/org/oppia/android/app/options/OptionsActivity.kt index 87be4aeb2e9..ccbcea40b7b 100644 --- a/app/src/main/java/org/oppia/android/app/options/OptionsActivity.kt +++ b/app/src/main/java/org/oppia/android/app/options/OptionsActivity.kt @@ -1,12 +1,9 @@ package org.oppia.android.app.options -import android.app.Activity import android.content.Context import android.content.Intent import android.os.Bundle import android.widget.TextView -import androidx.activity.result.ActivityResultLauncher -import androidx.activity.result.contract.ActivityResultContracts import org.oppia.android.R import org.oppia.android.app.activity.ActivityComponentImpl import org.oppia.android.app.activity.InjectableAutoLocalizedAppCompatActivity @@ -52,9 +49,6 @@ class OptionsActivity : private lateinit var selectedFragment: String private var profileId: Int? = -1 - private lateinit var audioLanguageResultLauncher: ActivityResultLauncher - private lateinit var textSizeResultLauncher: ActivityResultLauncher - companion object { // TODO(#1655): Re-restrict access to fields in tests post-Gradle. /** [Boolean] indicating whether user is navigating from Drawer. */ @@ -102,29 +96,26 @@ class OptionsActivity : profileId!! ) title = resourceHandler.getStringInLocale(R.string.menu_options) + } - audioLanguageResultLauncher = registerForActivityResult( - ActivityResultContracts.StartActivityForResult() - ) { result -> - if (result.resultCode == Activity.RESULT_OK) { - val data: Intent? = result.data - val audioLanguage = data?.getProtoExtra( - MESSAGE_AUDIO_LANGUAGE_RESULTS_KEY, AudioLanguageActivityResultBundle.getDefaultInstance() - )?.audioLanguage - optionActivityPresenter.updateAudioLanguage(audioLanguage!!) - } + override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { + super.onActivityResult(requestCode, resultCode, data) + checkNotNull(data) { + "Expected data to be passed as an activity result for request: $requestCode." } - - textSizeResultLauncher = registerForActivityResult( - ActivityResultContracts.StartActivityForResult() - ) { result -> - if (result.resultCode == Activity.RESULT_OK) { - val data: Intent? = result.data - val textSizeResults = data?.getProtoExtra( + when (requestCode) { + REQUEST_CODE_TEXT_SIZE -> { + val textSizeResults = data.getProtoExtra( MESSAGE_READING_TEXT_SIZE_RESULTS_KEY, ReadingTextSizeActivityResultBundle.getDefaultInstance() ) - optionActivityPresenter.updateReadingTextSize(textSizeResults!!.selectedReadingTextSize!!) + optionActivityPresenter.updateReadingTextSize(textSizeResults.selectedReadingTextSize) + } + REQUEST_CODE_AUDIO_LANGUAGE -> { + val audioLanguage = data.getProtoExtra( + MESSAGE_AUDIO_LANGUAGE_RESULTS_KEY, AudioLanguageActivityResultBundle.getDefaultInstance() + ).audioLanguage + optionActivityPresenter.updateAudioLanguage(audioLanguage) } } } @@ -140,13 +131,17 @@ class OptionsActivity : } override fun routeAudioLanguageList(audioLanguage: AudioLanguage) { - val intent = AudioLanguageActivity.createAudioLanguageActivityIntent(this, audioLanguage) - audioLanguageResultLauncher.launch(intent) + startActivityForResult( + AudioLanguageActivity.createAudioLanguageActivityIntent(this, audioLanguage), + REQUEST_CODE_AUDIO_LANGUAGE + ) } override fun routeReadingTextSize(readingTextSize: ReadingTextSize) { - val intent = ReadingTextSizeActivity.createReadingTextSizeActivityIntent(this, readingTextSize) - textSizeResultLauncher.launch(intent) + startActivityForResult( + ReadingTextSizeActivity.createReadingTextSizeActivityIntent(this, readingTextSize), + REQUEST_CODE_TEXT_SIZE + ) } override fun loadReadingTextSizeFragment(textSize: ReadingTextSize) { diff --git a/app/src/main/java/org/oppia/android/app/profile/AddProfileActivity.kt b/app/src/main/java/org/oppia/android/app/profile/AddProfileActivity.kt index c372b960bd2..25c45ddb07f 100644 --- a/app/src/main/java/org/oppia/android/app/profile/AddProfileActivity.kt +++ b/app/src/main/java/org/oppia/android/app/profile/AddProfileActivity.kt @@ -1,10 +1,8 @@ package org.oppia.android.app.profile -import android.app.Activity import android.content.Context import android.content.Intent import android.os.Bundle -import androidx.activity.result.contract.ActivityResultContracts import org.oppia.android.app.activity.ActivityComponentImpl import org.oppia.android.app.activity.InjectableAutoLocalizedAppCompatActivity import org.oppia.android.app.model.ScreenName.ADD_PROFILE_ACTIVITY @@ -31,14 +29,6 @@ class AddProfileActivity : InjectableAutoLocalizedAppCompatActivity() { super.onCreate(savedInstanceState) (activityComponent as ActivityComponentImpl).inject(this) addProfileFragmentPresenter.handleOnCreate() - - addProfileFragmentPresenter.resultLauncher = registerForActivityResult( - ActivityResultContracts.StartActivityForResult() - ) { result -> - if (result.resultCode == Activity.RESULT_OK) { - addProfileFragmentPresenter.updateProfileAvatar(result.data) - } - } } override fun onSupportNavigateUp(): Boolean { @@ -49,6 +39,11 @@ class AddProfileActivity : InjectableAutoLocalizedAppCompatActivity() { return false } + override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { + super.onActivityResult(requestCode, resultCode, data) + addProfileFragmentPresenter.handleOnActivityResult(requestCode, resultCode, data) + } + override fun onDestroy() { super.onDestroy() addProfileFragmentPresenter.dismissAlertDialog() diff --git a/app/src/main/java/org/oppia/android/app/profile/AddProfileActivityPresenter.kt b/app/src/main/java/org/oppia/android/app/profile/AddProfileActivityPresenter.kt index c1f69adc3af..d138419c68d 100644 --- a/app/src/main/java/org/oppia/android/app/profile/AddProfileActivityPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/profile/AddProfileActivityPresenter.kt @@ -1,5 +1,6 @@ package org.oppia.android.app.profile +import android.app.Activity import android.content.Context import android.content.Intent import android.graphics.PorterDuff @@ -9,7 +10,6 @@ import android.provider.MediaStore import android.view.View import android.view.inputmethod.InputMethodManager import android.widget.ImageView -import androidx.activity.result.ActivityResultLauncher import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.widget.Toolbar @@ -34,6 +34,8 @@ import org.oppia.android.util.platformparameter.EnableDownloadsSupport import org.oppia.android.util.platformparameter.PlatformParameterValue import javax.inject.Inject +const val GALLERY_INTENT_RESULT_CODE = 1 + /** The presenter for [AddProfileActivity]. */ @ActivityScope class AddProfileActivityPresenter @Inject constructor( @@ -51,8 +53,6 @@ class AddProfileActivityPresenter @Inject constructor( private var inputtedConfirmPin = false private lateinit var alertDialog: AlertDialog - lateinit var resultLauncher: ActivityResultLauncher - fun handleOnCreate() { val binding = DataBindingUtil.setContentView( activity, @@ -181,25 +181,25 @@ class AddProfileActivityPresenter @Inject constructor( } } - fun updateProfileAvatar(data: Intent?) { - data?.let { - selectedImage = data.data - Glide.with(activity) - .load(selectedImage) - .centerCrop() - .apply(RequestOptions.circleCropTransform()) - .into(uploadImageView) + fun handleOnActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { + if (requestCode == GALLERY_INTENT_RESULT_CODE && resultCode == Activity.RESULT_OK) { + data?.let { + selectedImage = data.data + Glide.with(activity) + .load(selectedImage) + .centerCrop() + .apply(RequestOptions.circleCropTransform()) + .into(uploadImageView) + } } } private fun addButtonListeners(binding: AddProfileActivityBinding) { uploadImageView.setOnClickListener { - val galleryIntent = Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI) - resultLauncher.launch(galleryIntent) + openGalleryIntent() } binding.addProfileActivityEditUserImageView.setOnClickListener { - val galleryIntent = Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI) - resultLauncher.launch(galleryIntent) + openGalleryIntent() } binding.addProfileActivityCreateButton.setOnClickListener { @@ -241,6 +241,11 @@ class AddProfileActivityPresenter @Inject constructor( } } + private fun openGalleryIntent() { + val galleryIntent = Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI) + activity.startActivityForResult(galleryIntent, GALLERY_INTENT_RESULT_CODE) + } + private fun checkInputsAreValid(name: String, pin: String, confirmPin: String): Boolean { var failed = false if (name.isEmpty()) { diff --git a/app/src/main/java/org/oppia/android/app/profileprogress/ProfileProgressActivity.kt b/app/src/main/java/org/oppia/android/app/profileprogress/ProfileProgressActivity.kt index 48fa0a00e31..934076c3729 100644 --- a/app/src/main/java/org/oppia/android/app/profileprogress/ProfileProgressActivity.kt +++ b/app/src/main/java/org/oppia/android/app/profileprogress/ProfileProgressActivity.kt @@ -1,11 +1,8 @@ package org.oppia.android.app.profileprogress -import android.app.Activity import android.content.Context import android.content.Intent import android.os.Bundle -import androidx.activity.result.ActivityResultLauncher -import androidx.activity.result.contract.ActivityResultContracts import org.oppia.android.app.activity.ActivityComponentImpl import org.oppia.android.app.activity.InjectableAutoLocalizedAppCompatActivity import org.oppia.android.app.activity.route.ActivityRouter @@ -39,21 +36,11 @@ class ProfileProgressActivity : @Inject lateinit var resourceHandler: AppLanguageResourceHandler - private lateinit var resultLauncher: ActivityResultLauncher - override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) (activityComponent as ActivityComponentImpl).inject(this) internalProfileId = intent.getIntExtra(PROFILE_ID_EXTRA_KEY, -1) profileProgressActivityPresenter.handleOnCreate(internalProfileId) - - resultLauncher = registerForActivityResult( - ActivityResultContracts.StartActivityForResult() - ) { result -> - if (result.resultCode == Activity.RESULT_OK) { - profileProgressActivityPresenter.updateProfileAvatar(result.data) - } - } } override fun routeToRecentlyPlayed(recentlyPlayedActivityTitle: RecentlyPlayedActivityTitle) { @@ -112,7 +99,11 @@ class ProfileProgressActivity : } override fun showGalleryForProfilePicture() { - val galleryIntent = Intent(Intent.ACTION_GET_CONTENT).apply { type = "image/*" } - resultLauncher.launch(galleryIntent) + profileProgressActivityPresenter.openGalleryIntent() + } + + override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { + super.onActivityResult(requestCode, resultCode, data) + profileProgressActivityPresenter.handleOnActivityResult(data) } } diff --git a/app/src/main/java/org/oppia/android/app/profileprogress/ProfileProgressActivityPresenter.kt b/app/src/main/java/org/oppia/android/app/profileprogress/ProfileProgressActivityPresenter.kt index 836f5cfc0d5..562e38f3d9f 100644 --- a/app/src/main/java/org/oppia/android/app/profileprogress/ProfileProgressActivityPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/profileprogress/ProfileProgressActivityPresenter.kt @@ -7,6 +7,7 @@ import androidx.appcompat.widget.Toolbar import org.oppia.android.R import org.oppia.android.app.activity.ActivityScope import org.oppia.android.app.model.ProfileId +import org.oppia.android.app.profile.GALLERY_INTENT_RESULT_CODE import org.oppia.android.domain.profile.ProfileManagementController import javax.inject.Inject @@ -49,11 +50,18 @@ class ProfileProgressActivityPresenter @Inject constructor( ) as ProfileProgressFragment? } - fun updateProfileAvatar(intent: Intent?) { - profileManagementController.updateProfileAvatar( - profileId, - intent?.data, - /* colorRgb= */ 10710042 - ) + fun openGalleryIntent() { + val galleryIntent = Intent(Intent.ACTION_GET_CONTENT).apply { type = "image/*" } + activity.startActivityForResult(galleryIntent, GALLERY_INTENT_RESULT_CODE) + } + + fun handleOnActivityResult(intent: Intent?) { + intent?.let { + profileManagementController.updateProfileAvatar( + profileId, + intent.data, + /* colorRgb= */ 10710042 + ) + } } } From ebee07a114d899d036a6f4b5f7f70ad3f1c6dccc Mon Sep 17 00:00:00 2001 From: Ben Henning Date: Sat, 25 May 2024 21:14:30 -0700 Subject: [PATCH 4/5] Attempt to update to newer Compose versions. This puts our attempt in-line with the rules_kotlin example closest to our version. --- third_party/maven_install.json | 170 +++++++++++++++++++++------------ third_party/versions.bzl | 14 +-- tools/kotlin/BUILD.bazel | 10 +- 3 files changed, 120 insertions(+), 74 deletions(-) diff --git a/third_party/maven_install.json b/third_party/maven_install.json index a6ee074c7a9..53d7671428c 100644 --- a/third_party/maven_install.json +++ b/third_party/maven_install.json @@ -1,12 +1,12 @@ { "__AUTOGENERATED_FILE_DO_NOT_MODIFY_THIS_FILE_MANUALLY": "THERE_IS_NO_DATA_ONLY_ZUUL", - "__INPUT_ARTIFACTS_HASH": -1656851166, - "__RESOLVED_ARTIFACTS_HASH": 1003164918, + "__INPUT_ARTIFACTS_HASH": 543419463, + "__RESOLVED_ARTIFACTS_HASH": 12384646, "conflict_resolution": { "androidx.annotation:annotation:1.1.0": "androidx.annotation:annotation:1.2.0", "androidx.constraintlayout:constraintlayout:1.1.3": "androidx.constraintlayout:constraintlayout:2.0.1", - "androidx.core:core-ktx:1.0.1": "androidx.core:core-ktx:1.1.0", - "androidx.core:core:1.0.1": "androidx.core:core:1.5.0", + "androidx.core:core-ktx:1.0.1": "androidx.core:core-ktx:1.5.0", + "androidx.core:core:1.0.1": "androidx.core:core:1.7.0", "androidx.lifecycle:lifecycle-livedata-core:2.2.0": "androidx.lifecycle:lifecycle-livedata-core:2.3.1", "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0": "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1", "androidx.recyclerview:recyclerview:1.0.0": "androidx.recyclerview:recyclerview:1.1.0", @@ -22,21 +22,21 @@ "artifacts": { "androidx.activity:activity-compose:aar": { "shasums": { - "jar": "32b2cdbb3ffb514bb4e09d00a7b4ccacf1dbb78a4a16fad0a600cf1c37204382" + "jar": "82f97c1c4b96d15ee721b8204bd1273f80bcc654e50d0b16ca5399c77f6c3531" }, - "version": "1.3.0" + "version": "1.4.0" }, "androidx.activity:activity-ktx:aar": { "shasums": { - "jar": "675df62188fa9dc2f470ace72a00ccd154472e26efb6137bff4adc34ce670f18" + "jar": "3f301941f37a90b4bc553dbbe84e7464a97c0d21df6cf2d6c0cb1b2c07349f33" }, - "version": "1.3.0" + "version": "1.4.0" }, "androidx.activity:activity:aar": { "shasums": { - "jar": "db584d89011a078829209d24157b3256ca8985b1c6c000204eebe9973a7d09da" + "jar": "89dc38e0cdbd11f328c7d0b3b021ddb387ca9da0d49f14b18c91e300c45ed79c" }, - "version": "1.3.0" + "version": "1.4.0" }, "androidx.annotation:annotation": { "shasums": { @@ -46,9 +46,9 @@ }, "androidx.annotation:annotation-experimental:aar": { "shasums": { - "jar": "b219d2b568e7e4ba534e09f8c2fd242343df6ccbdfbbe938846f5d740e6b0b11" + "jar": "0157de61a2064047896a058080f3fd67ba57ad9a94857b3f7a363660243e3f90" }, - "version": "1.0.0" + "version": "1.1.0" }, "androidx.appcompat:appcompat-resources:aar": { "shasums": { @@ -100,97 +100,103 @@ }, "androidx.compose.animation:animation-core:aar": { "shasums": { - "jar": "5365c3e79957a0e04ced9889d4e7d2ad4aa7b5defdc239b9b4dcee12ac52b7c0" + "jar": "797048e2d03a9b1b98443fbe118d70f0955988e3fca56a71985ee3550be46f4e" }, - "version": "1.0.0" + "version": "1.1.1" }, "androidx.compose.animation:animation:aar": { "shasums": { - "jar": "06a01ac38d5d8c1177de64bfe973b1d5b085a0399b216ca3d1d2ae90e9685726" + "jar": "95fca9d5bbb8da8c4f351331558e7b2f4ec04db0cf290b021852423461d76a9c" }, - "version": "1.0.0" + "version": "1.1.1" }, "androidx.compose.compiler:compiler": { "shasums": { - "jar": "afd6bf023d4ae11845a0457a10f4c0be17ed4b2b4c6828a0618ab2eb2500989a" + "jar": "7d5077161c59f478f175672c7a8ce6321e5d549337ae9482962e5398ec79fe56" }, - "version": "1.0.0" + "version": "1.2.0" }, "androidx.compose.foundation:foundation-layout:aar": { "shasums": { - "jar": "1ef28dd57922f8432972b596e592504cde886cfbdfca5ede832871b54d654ef3" + "jar": "f1143c6c62a7de22dcf42e8b1ef6a1c131e1492cddef3662efe8eb72c7fdb107" }, - "version": "1.0.0" + "version": "1.2.0" }, "androidx.compose.foundation:foundation:aar": { "shasums": { - "jar": "dc9efde98d865b5b16ad26628cb3909ba94b487e9749124e15b57362cc587615" + "jar": "088ab2fff41f23ca655db48beaaf0b74ad06f452d6164863ce6735333fc9d497" }, - "version": "1.0.0" + "version": "1.2.0" }, "androidx.compose.material:material-icons-core:aar": { "shasums": { - "jar": "6e049492ec2ff0a6a1166a5985a924cf4de03465d17462594284f81eafe1a9dd" + "jar": "43c92a176e343d5db6ba316949de935748d8338ca604406da016fd135498c957" }, - "version": "1.0.0" + "version": "1.2.0" }, "androidx.compose.material:material-ripple:aar": { "shasums": { - "jar": "0d3ac24c815fba15c57e1ca03f406399cd69ac1e41e390f61258c22a3226f550" + "jar": "2d253f387801ea76b8a3086bb363887d1200b03e2723575892d13d8150296295" }, - "version": "1.0.0" + "version": "1.2.0" }, "androidx.compose.material:material:aar": { "shasums": { - "jar": "5b1efb82311098418e9f61c5d3aa95d8e44fc36319d23a2901232fbe7f147d8b" + "jar": "315f05e428b3faf25ad080fdeaa3074c20624255d0a323aed17072c6f07a6eae" }, - "version": "1.0.0" + "version": "1.2.0" }, "androidx.compose.runtime:runtime-saveable:aar": { "shasums": { - "jar": "08764969c5a0674d0e40669fb0c97b2aa0f915db8dd8e51d978f09c448233142" + "jar": "15e4adbb3091b06c9f47635a558244e8c8ef3e616c3a3b3192e524aa3bbfbcf0" }, - "version": "1.0.0" + "version": "1.2.0" }, "androidx.compose.runtime:runtime:aar": { "shasums": { - "jar": "6f1b4762fb8db93506aae72555ed2da1ee6bcfe0acb80dd9053868807422a5f1" + "jar": "0a49a51ce083ce5d282172d4e2509d792205dddbc652ea2aff061e507e546990" }, - "version": "1.0.0" + "version": "1.2.0" }, "androidx.compose.ui:ui-geometry:aar": { "shasums": { - "jar": "da5b6793c694beca64efc165afb5831ebb34a0c9bafb9ef7ee636a3b7de910d0" + "jar": "4b1ac2963e19147fae4f9f116690ff64f011137607fec429e40bcaa169d83bb4" }, - "version": "1.0.0" + "version": "1.2.0" }, "androidx.compose.ui:ui-graphics:aar": { "shasums": { - "jar": "00da5e7f92f2adadf96e6ee89e0a65479f83c60a85fbbefd7bcb71b05a2b29f8" + "jar": "58606617a8e71e58eba56bd79410c77c6df79017bb058cf64cce1def3af463de" }, - "version": "1.0.0" + "version": "1.2.0" }, "androidx.compose.ui:ui-text:aar": { "shasums": { - "jar": "ee38b166b926984393b79936617e77c9ae212a7c250d0cc125fcdb22e83261b0" + "jar": "8143d7e6bb293b81e404331a35ba5b749cfa8ac1c45c07bbe260261d0a83b3b7" }, - "version": "1.0.0" + "version": "1.2.0" }, "androidx.compose.ui:ui-unit:aar": { "shasums": { - "jar": "17bb4fe548680e9bc11d4a605b01a6d7744e2ddab04ca93b7709378522792b72" + "jar": "09184bed04f3e13c73f90d0087ec3ec1f92832191b8e4494fc3c68a4b179d2a3" }, - "version": "1.0.0" + "version": "1.2.0" }, "androidx.compose.ui:ui-util:aar": { "shasums": { - "jar": "06dc15e9cbb724bb1f4678af2a354acc5a15fb0ee5dcc6322e780caaf0559078" + "jar": "0cfc6911f25c76388f0e8ed567cf5cb19619f7a07fe3f9d6236f0b7866263c40" }, - "version": "1.0.0" + "version": "1.2.0" }, "androidx.compose.ui:ui:aar": { "shasums": { - "jar": "ce083682bacb4dd929402c11b2c3f6817de400b4839538ac186563e3f6e46840" + "jar": "499cadfff85f101632da3369d49fce148c44d6d1e39b6b1a8c73bd5083022472" + }, + "version": "1.2.0" + }, + "androidx.concurrent:concurrent-futures": { + "shasums": { + "jar": "5595a40e278a7b39fa78a09490e3d7f3faa95c7b01447148bd38b5ade0605c35" }, "version": "1.0.0" }, @@ -214,15 +220,15 @@ }, "androidx.core:core-ktx:aar": { "shasums": { - "jar": "070cc5f8864f449128a2f4b25ca5b67aa3adca3ee1bd611e2eaf1a18fad83178" + "jar": "5964cfe7a4882da2a00fb6ca3d3a072d04139208186f7bc4b3cb66022764fc42" }, - "version": "1.1.0" + "version": "1.5.0" }, "androidx.core:core:aar": { "shasums": { - "jar": "2b279712795689069cfb63e48b3ab63c32a5649bdda44c482eb8f81ca1a72161" + "jar": "aaf6734226fff923784f92f65d78a2984dbf17534138855c5ce2038f18656e0b" }, - "version": "1.5.0" + "version": "1.7.0" }, "androidx.cursoradapter:cursoradapter:aar": { "shasums": { @@ -230,6 +236,12 @@ }, "version": "1.0.0" }, + "androidx.customview:customview-poolingcontainer:aar": { + "shasums": { + "jar": "3584102fc49bf399c56e3b7be4bfe12000c46112320cd8cf85cc0a8f93f3e752" + }, + "version": "1.0.0" + }, "androidx.customview:customview:aar": { "shasums": { "jar": "01f76ab043770a97b054046f9815717b82ce0355c02967d16c61981359dc189a" @@ -310,9 +322,9 @@ }, "androidx.lifecycle:lifecycle-common": { "shasums": { - "jar": "15848fb56db32f4c7cdc72b324003183d52a4884d6bf09be708ac7f587d139b5" + "jar": "20ad1520f625cf455e6afd7290988306d3a9886efa993e0860fbabf4bb3f7bda" }, - "version": "2.3.1" + "version": "2.4.0" }, "androidx.lifecycle:lifecycle-common-java8": { "shasums": { @@ -472,9 +484,9 @@ }, "androidx.profileinstaller:profileinstaller:aar": { "shasums": { - "jar": "2e73a7c40e4dda1482a0537b77fdfb2db46b5c4b4cd33ad05d265097fb8a05da" + "jar": "0a1b2260af67962f4038d56fa84cda341315704aad56abbcf3a9b3bba6945426" }, - "version": "1.0.0" + "version": "1.2.0" }, "androidx.recyclerview:recyclerview:aar": { "shasums": { @@ -496,15 +508,15 @@ }, "androidx.savedstate:savedstate-ktx:aar": { "shasums": { - "jar": "e44d61347463b0fafeeb649cbcc3d7109b2eb5e11d1522e986105170cdebbf68" + "jar": "43112928d3cbb108801ee11130f303404bc4892cf78908811568195107bba7fe" }, - "version": "1.1.0" + "version": "1.2.0" }, "androidx.savedstate:savedstate:aar": { "shasums": { - "jar": "d60bbe44c2c08083a17c5dc678a6d6b4d0a2d664858016ab5c049cbea90a63b7" + "jar": "2de528d6898e95ef020d22d9ffdf9d1f77cbdd93f92d39dfaa5d5c43b0c311c8" }, - "version": "1.1.0" + "version": "1.2.0" }, "androidx.sqlite:sqlite-framework:aar": { "shasums": { @@ -520,9 +532,9 @@ }, "androidx.startup:startup-runtime:aar": { "shasums": { - "jar": "ff081d2db7dd28aec59f74934c514fbaf4ae5aac5258495fe10d612a3622f876" + "jar": "e0a6329a371262fe4c450372b70fdaf33b769ef6917094723787cfce896b1dd3" }, - "version": "1.0.0" + "version": "1.1.1" }, "androidx.test.espresso:espresso-accessibility:aar": { "shasums": { @@ -1935,7 +1947,8 @@ "androidx.lifecycle:lifecycle-viewmodel-savedstate:aar", "androidx.lifecycle:lifecycle-viewmodel:aar", "androidx.savedstate:savedstate:aar", - "androidx.tracing:tracing:aar" + "androidx.tracing:tracing:aar", + "org.jetbrains.kotlin:kotlin-stdlib" ], "androidx.appcompat:appcompat-resources:aar": [ "androidx.annotation:annotation", @@ -1996,9 +2009,12 @@ ], "androidx.compose.foundation:foundation-layout:aar": [ "androidx.annotation:annotation", + "androidx.compose.animation:animation-core:aar", "androidx.compose.runtime:runtime:aar", + "androidx.compose.ui:ui-unit:aar", "androidx.compose.ui:ui-util:aar", "androidx.compose.ui:ui:aar", + "androidx.core:core:aar", "org.jetbrains.kotlin:kotlin-stdlib-common" ], "androidx.compose.foundation:foundation:aar": [ @@ -2006,12 +2022,14 @@ "androidx.compose.animation:animation:aar", "androidx.compose.foundation:foundation-layout:aar", "androidx.compose.runtime:runtime:aar", + "androidx.compose.ui:ui-graphics:aar", "androidx.compose.ui:ui-text:aar", "androidx.compose.ui:ui-util:aar", "androidx.compose.ui:ui:aar", "org.jetbrains.kotlin:kotlin-stdlib-common" ], "androidx.compose.material:material-icons-core:aar": [ + "androidx.compose.runtime:runtime:aar", "androidx.compose.ui:ui:aar", "org.jetbrains.kotlin:kotlin-stdlib" ], @@ -2033,6 +2051,9 @@ "androidx.compose.ui:ui-text:aar", "androidx.compose.ui:ui-util:aar", "androidx.compose.ui:ui:aar", + "androidx.lifecycle:lifecycle-runtime:aar", + "androidx.lifecycle:lifecycle-viewmodel:aar", + "androidx.savedstate:savedstate:aar", "org.jetbrains.kotlin:kotlin-stdlib-common" ], "androidx.compose.runtime:runtime-saveable:aar": [ @@ -2068,7 +2089,8 @@ "androidx.compose.ui:ui-util:aar", "androidx.core:core:aar", "org.jetbrains.kotlin:kotlin-stdlib", - "org.jetbrains.kotlin:kotlin-stdlib-common" + "org.jetbrains.kotlin:kotlin-stdlib-common", + "org.jetbrains.kotlinx:kotlinx-coroutines-core" ], "androidx.compose.ui:ui-unit:aar": [ "androidx.annotation:annotation", @@ -2083,6 +2105,7 @@ "androidx.compose.ui:ui:aar": [ "androidx.annotation:annotation", "androidx.autofill:autofill:aar", + "androidx.collection:collection", "androidx.compose.runtime:runtime-saveable:aar", "androidx.compose.runtime:runtime:aar", "androidx.compose.ui:ui-geometry:aar", @@ -2090,16 +2113,22 @@ "androidx.compose.ui:ui-text:aar", "androidx.compose.ui:ui-unit:aar", "androidx.compose.ui:ui-util:aar", + "androidx.core:core:aar", + "androidx.customview:customview-poolingcontainer:aar", "androidx.lifecycle:lifecycle-common-java8", "androidx.lifecycle:lifecycle-runtime:aar", "androidx.lifecycle:lifecycle-viewmodel:aar", "androidx.profileinstaller:profileinstaller:aar", - "androidx.savedstate:savedstate:aar", + "androidx.savedstate:savedstate-ktx:aar", "org.jetbrains.kotlin:kotlin-stdlib", "org.jetbrains.kotlin:kotlin-stdlib-common", "org.jetbrains.kotlinx:kotlinx-coroutines-android", "org.jetbrains.kotlinx:kotlinx-coroutines-core" ], + "androidx.concurrent:concurrent-futures": [ + "androidx.annotation:annotation", + "com.google.guava:listenablefuture" + ], "androidx.constraintlayout:constraintlayout:aar": [ "androidx.appcompat:appcompat:aar", "androidx.constraintlayout:constraintlayout-solver", @@ -2118,13 +2147,19 @@ ], "androidx.core:core:aar": [ "androidx.annotation:annotation", + "androidx.annotation:annotation-experimental:aar", "androidx.collection:collection", + "androidx.concurrent:concurrent-futures", "androidx.lifecycle:lifecycle-runtime:aar", "androidx.versionedparcelable:versionedparcelable:aar" ], "androidx.cursoradapter:cursoradapter:aar": [ "androidx.annotation:annotation" ], + "androidx.customview:customview-poolingcontainer:aar": [ + "androidx.core:core-ktx:aar", + "org.jetbrains.kotlin:kotlin-stdlib" + ], "androidx.customview:customview:aar": [ "androidx.annotation:annotation", "androidx.collection:collection", @@ -2346,7 +2381,8 @@ "androidx.savedstate:savedstate:aar": [ "androidx.annotation:annotation", "androidx.arch.core:core-common", - "androidx.lifecycle:lifecycle-common" + "androidx.lifecycle:lifecycle-common", + "org.jetbrains.kotlin:kotlin-stdlib" ], "androidx.sqlite:sqlite-framework:aar": [ "androidx.annotation:annotation", @@ -3324,9 +3360,13 @@ "androidx.compose.compiler:compiler": [ "androidx.compose.compiler.plugins.kotlin", "androidx.compose.compiler.plugins.kotlin.analysis", + "androidx.compose.compiler.plugins.kotlin.inference", "androidx.compose.compiler.plugins.kotlin.lower", "androidx.compose.compiler.plugins.kotlin.lower.decoys" ], + "androidx.concurrent:concurrent-futures": [ + "androidx.concurrent.futures" + ], "androidx.constraintlayout:constraintlayout-solver": [ "androidx.constraintlayout.solver", "androidx.constraintlayout.solver.state", @@ -6735,12 +6775,14 @@ "androidx.compose.ui:ui-unit:aar", "androidx.compose.ui:ui-util:aar", "androidx.compose.ui:ui:aar", + "androidx.concurrent:concurrent-futures", "androidx.constraintlayout:constraintlayout-solver", "androidx.constraintlayout:constraintlayout:aar", "androidx.coordinatorlayout:coordinatorlayout:aar", "androidx.core:core-ktx:aar", "androidx.core:core:aar", "androidx.cursoradapter:cursoradapter:aar", + "androidx.customview:customview-poolingcontainer:aar", "androidx.customview:customview:aar", "androidx.databinding:databinding-adapters:aar", "androidx.databinding:databinding-common", @@ -7052,12 +7094,14 @@ "androidx.compose.ui:ui-unit:aar", "androidx.compose.ui:ui-util:aar", "androidx.compose.ui:ui:aar", + "androidx.concurrent:concurrent-futures", "androidx.constraintlayout:constraintlayout-solver", "androidx.constraintlayout:constraintlayout:aar", "androidx.coordinatorlayout:coordinatorlayout:aar", "androidx.core:core-ktx:aar", "androidx.core:core:aar", "androidx.cursoradapter:cursoradapter:aar", + "androidx.customview:customview-poolingcontainer:aar", "androidx.customview:customview:aar", "androidx.databinding:databinding-adapters:aar", "androidx.databinding:databinding-common", @@ -7369,12 +7413,14 @@ "androidx.compose.ui:ui-unit:aar", "androidx.compose.ui:ui-util:aar", "androidx.compose.ui:ui:aar", + "androidx.concurrent:concurrent-futures", "androidx.constraintlayout:constraintlayout-solver", "androidx.constraintlayout:constraintlayout:aar", "androidx.coordinatorlayout:coordinatorlayout:aar", "androidx.core:core-ktx:aar", "androidx.core:core:aar", "androidx.cursoradapter:cursoradapter:aar", + "androidx.customview:customview-poolingcontainer:aar", "androidx.customview:customview:aar", "androidx.databinding:databinding-adapters:aar", "androidx.databinding:databinding-common", @@ -7686,12 +7732,14 @@ "androidx.compose.ui:ui-unit:aar", "androidx.compose.ui:ui-util:aar", "androidx.compose.ui:ui:aar", + "androidx.concurrent:concurrent-futures", "androidx.constraintlayout:constraintlayout-solver", "androidx.constraintlayout:constraintlayout:aar", "androidx.coordinatorlayout:coordinatorlayout:aar", "androidx.core:core-ktx:aar", "androidx.core:core:aar", "androidx.cursoradapter:cursoradapter:aar", + "androidx.customview:customview-poolingcontainer:aar", "androidx.customview:customview:aar", "androidx.databinding:databinding-adapters:aar", "androidx.databinding:databinding-common", diff --git a/third_party/versions.bzl b/third_party/versions.bzl index ffdc3d20e79..69877e68d0b 100644 --- a/third_party/versions.bzl +++ b/third_party/versions.bzl @@ -23,15 +23,15 @@ MAVEN_PRODUCTION_DEPENDENCY_VERSIONS = { "androidx.annotation:annotation": "1.1.0", "androidx.appcompat:appcompat": "1.2.0", "androidx.constraintlayout:constraintlayout": "1.1.3", - "androidx.activity:activity-compose":"1.3.0", + "androidx.activity:activity-compose": "1.4.0", "androidx.core:core": "1.0.1", "androidx.core:core-ktx": "1.0.1", - "androidx.compose.compiler:compiler": "1.0.0", - "androidx.compose.foundation:foundation":"1.0.0", - "androidx.compose.foundation:foundation-layout":"1.0.0", - "androidx.compose.material:material":"1.0.0", - "androidx.compose.runtime:runtime":"1.0.0", - "androidx.compose.ui:ui":"1.0.0", + "androidx.compose.compiler:compiler": "1.2.0", + "androidx.compose.foundation:foundation": "1.2.0", + "androidx.compose.foundation:foundation-layout": "1.2.0", + "androidx.compose.material:material": "1.2.0", + "androidx.compose.runtime:runtime": "1.2.0", + "androidx.compose.ui:ui": "1.2.0", "androidx.databinding:databinding-adapters": "3.4.2", "androidx.databinding:databinding-common": "3.4.2", "androidx.databinding:databinding-compiler": "3.4.2", diff --git a/tools/kotlin/BUILD.bazel b/tools/kotlin/BUILD.bazel index f47e599675a..52b33536128 100644 --- a/tools/kotlin/BUILD.bazel +++ b/tools/kotlin/BUILD.bazel @@ -2,7 +2,7 @@ Configurations for a codebase-wide build toolchain for Kotlin. """ -load("@io_bazel_rules_kotlin//kotlin:core.bzl", "define_kt_toolchain", "kt_javac_options", "kt_kotlinc_options", "kt_compiler_plugin") +load("@io_bazel_rules_kotlin//kotlin:core.bzl", "define_kt_toolchain", "kt_compiler_plugin", "kt_javac_options", "kt_kotlinc_options") # This exposes a patch that fixes an issue with duplicate processor arguments. See: # github.com/bazelbuild/rules_kotlin/pull/940. @@ -10,7 +10,7 @@ exports_files(["remove_processor_duplicates.patch"]) kt_kotlinc_options( name = "oppia_kotlinc_options", - warn = "error", + warn = "report", x_optin = ["kotlin.RequiresOptIn"], ) @@ -36,8 +36,6 @@ kt_compiler_plugin( name = "jetpack_compose_compiler_plugin", id = "androidx.compose.compiler", target_embedded_compiler = True, - visibility = ["//visibility:public"], - deps = [ - "//third_party:androidx_compose_compiler_compiler", - ], + visibility = ["//app:app_visibility"], + deps = ["//third_party:androidx_compose_compiler_compiler"], ) From 833a5efc2da5064b532d916b85f7eea77fac0314 Mon Sep 17 00:00:00 2001 From: Ben Henning Date: Sun, 26 May 2024 12:09:00 -0700 Subject: [PATCH 5/5] Get Jetpack Compose working. This fully demonstrates a working Bazel build, plus sticky headers working without issue. --- WORKSPACE | 4 +- .../android/app/home/HomeFragmentPresenter.kt | 26 ++-- build.gradle | 2 +- third_party/BUILD.bazel | 12 +- third_party/maven_install.json | 136 ++++++++---------- third_party/versions.bzl | 16 +-- 6 files changed, 91 insertions(+), 105 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index d5a88003f01..eab0165893d 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -37,8 +37,8 @@ load("@io_bazel_rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", " # Use the 1.6 compiler since Kotlin 1.6 is the current supported version in the repository. kotlin_repositories( compiler_release = kotlinc_version( - release = "1.6.21", - sha256 = "632166fed89f3f430482f5aa07f2e20b923b72ef688c8f5a7df3aa1502c6d8ba", + release = "1.6.10", + sha256 = "432267996d0d6b4b17ca8de0f878e44d4a099b7e9f1587a98edc4d27e76c215a", ), ) diff --git a/app/src/main/java/org/oppia/android/app/home/HomeFragmentPresenter.kt b/app/src/main/java/org/oppia/android/app/home/HomeFragmentPresenter.kt index 6ca394e5842..14347d75abb 100644 --- a/app/src/main/java/org/oppia/android/app/home/HomeFragmentPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/home/HomeFragmentPresenter.kt @@ -5,13 +5,19 @@ import android.view.View import android.view.ViewGroup import androidx.appcompat.app.AppCompatActivity import androidx.compose.foundation.ExperimentalFoundationApi +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn -import androidx.compose.material.ExperimentalMaterialApi +import androidx.compose.foundation.lazy.items import androidx.compose.material.MaterialTheme import androidx.compose.material.Text import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.ViewCompositionStrategy -import androidx.compose.ui.unit.ExperimentalUnitApi +import androidx.compose.ui.unit.dp import androidx.fragment.app.Fragment import androidx.lifecycle.Observer import androidx.recyclerview.widget.GridLayoutManager @@ -124,18 +130,18 @@ class HomeFragmentPresenter @Inject constructor( return binding.root } - @OptIn( - ExperimentalFoundationApi::class, - ExperimentalUnitApi::class, - ExperimentalMaterialApi::class - ) + @OptIn(ExperimentalFoundationApi::class) @Composable fun GroupedList() { - val sections = listOf("A", "B", "C") + val sections = listOf("A", "B", "C", "D", "E", "F", "G") - LazyColumn { - sections.forEach { + LazyColumn(contentPadding = PaddingValues(6.dp)) { + sections.forEach { sectionName -> stickyHeader { + Text( + "Section $sectionName", + Modifier.fillMaxWidth().background(Color.LightGray).padding(8.dp) + ) } items(10) { item -> Text(text = "Some item $item") diff --git a/build.gradle b/build.gradle index e4b24177c0f..97172637258 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.6.21' + ext.kotlin_version = '1.6.10' ext.fragment_version = '1.2.0-rc01' repositories { google() diff --git a/third_party/BUILD.bazel b/third_party/BUILD.bazel index d260621f6a0..6ad08a09c82 100644 --- a/third_party/BUILD.bazel +++ b/third_party/BUILD.bazel @@ -19,22 +19,18 @@ load(":versions.bzl", "MAVEN_PRODUCTION_DEPENDENCY_VERSIONS", "MAVEN_TEST_DEPEND # Create an android library wrapper for all production dependencies. Note that artifact is used so # that the correct Maven repository (default) is selected. This allows future customization # potential in managing multiple Maven repositories. -[android_library( +[alias( name = name.replace(":", "_").replace(".", "_"), + actual = artifact("%s:%s" % (name, version)), visibility = ["//visibility:public"], - exports = [ - artifact("%s:%s" % (name, version)), - ], ) for name, version in MAVEN_PRODUCTION_DEPENDENCY_VERSIONS.items()] # Create an android library wrapper for all test dependencies. -[android_library( +[alias( name = name.replace(":", "_").replace(".", "_"), testonly = True, + actual = artifact("%s:%s" % (name, version)), visibility = ["//visibility:public"], - exports = [ - artifact("%s:%s" % (name, version)), - ], ) for name, version in MAVEN_TEST_DEPENDENCY_VERSIONS.items()] # A wrapper dependency for the custom Git import of Android SVG (so that dependencies on this diff --git a/third_party/maven_install.json b/third_party/maven_install.json index 53d7671428c..29370dc70ad 100644 --- a/third_party/maven_install.json +++ b/third_party/maven_install.json @@ -1,11 +1,11 @@ { "__AUTOGENERATED_FILE_DO_NOT_MODIFY_THIS_FILE_MANUALLY": "THERE_IS_NO_DATA_ONLY_ZUUL", - "__INPUT_ARTIFACTS_HASH": 543419463, - "__RESOLVED_ARTIFACTS_HASH": 12384646, + "__INPUT_ARTIFACTS_HASH": -1588965950, + "__RESOLVED_ARTIFACTS_HASH": -317380977, "conflict_resolution": { "androidx.annotation:annotation:1.1.0": "androidx.annotation:annotation:1.2.0", "androidx.constraintlayout:constraintlayout:1.1.3": "androidx.constraintlayout:constraintlayout:2.0.1", - "androidx.core:core-ktx:1.0.1": "androidx.core:core-ktx:1.5.0", + "androidx.core:core-ktx:1.0.1": "androidx.core:core-ktx:1.1.0", "androidx.core:core:1.0.1": "androidx.core:core:1.7.0", "androidx.lifecycle:lifecycle-livedata-core:2.2.0": "androidx.lifecycle:lifecycle-livedata-core:2.3.1", "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0": "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1", @@ -16,7 +16,7 @@ "com.google.truth:truth:0.43": "com.google.truth:truth:1.1.3", "junit:junit:4.12": "junit:junit:4.13.2", "org.jetbrains.kotlin:kotlin-reflect:1.3.41": "org.jetbrains.kotlin:kotlin-reflect:1.6.0", - "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72": "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21", + "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10": "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21", "org.mockito:mockito-core:2.19.0": "org.mockito:mockito-core:3.9.0" }, "artifacts": { @@ -52,15 +52,15 @@ }, "androidx.appcompat:appcompat-resources:aar": { "shasums": { - "jar": "c470297c03ff3de1c3d15dacf0be0cae63abc10b52f021dd07ae28daa3100fe5" + "jar": "e3306cd3e9a19a28a5de5ec3b379580f237c4d81c15c3d795404be9291890a75" }, - "version": "1.2.0" + "version": "1.3.1" }, "androidx.appcompat:appcompat:aar": { "shasums": { - "jar": "3d2131a55a61a777322e2126e0018011efa6339e53b44153eb651b16020cca70" + "jar": "959b1daefe40d5e7eed1022f97730b22bc5fd52e6a6083eba284fa86c2971303" }, - "version": "1.2.0" + "version": "1.3.1" }, "androidx.arch.core:core-common": { "shasums": { @@ -112,87 +112,87 @@ }, "androidx.compose.compiler:compiler": { "shasums": { - "jar": "7d5077161c59f478f175672c7a8ce6321e5d549337ae9482962e5398ec79fe56" + "jar": "925acb226edfade11905827a8387bca83f83d6bd1a13f48708d1efab2129520a" }, - "version": "1.2.0" + "version": "1.1.1" }, "androidx.compose.foundation:foundation-layout:aar": { "shasums": { - "jar": "f1143c6c62a7de22dcf42e8b1ef6a1c131e1492cddef3662efe8eb72c7fdb107" + "jar": "8337856c1babb54bdadfdb97eea47eb94640fc5557f91de47d35e9158258a971" }, - "version": "1.2.0" + "version": "1.1.1" }, "androidx.compose.foundation:foundation:aar": { "shasums": { - "jar": "088ab2fff41f23ca655db48beaaf0b74ad06f452d6164863ce6735333fc9d497" + "jar": "7f5fff6b1d462c7e411533b75ec0a9a73027f9a38f1e85ae8309295811ab64a0" }, - "version": "1.2.0" + "version": "1.1.1" }, "androidx.compose.material:material-icons-core:aar": { "shasums": { - "jar": "43c92a176e343d5db6ba316949de935748d8338ca604406da016fd135498c957" + "jar": "8c9c1a9688a9f4dee57d31de8784d0970919fa939a48a466380815b9ebd84cfa" }, - "version": "1.2.0" + "version": "1.1.1" }, "androidx.compose.material:material-ripple:aar": { "shasums": { - "jar": "2d253f387801ea76b8a3086bb363887d1200b03e2723575892d13d8150296295" + "jar": "c84f77c84e0c9ac17d513d38611894558bea6592c5318976fc8b0a51bc3cf8f2" }, - "version": "1.2.0" + "version": "1.1.1" }, "androidx.compose.material:material:aar": { "shasums": { - "jar": "315f05e428b3faf25ad080fdeaa3074c20624255d0a323aed17072c6f07a6eae" + "jar": "538ab37092d8e837e0d7e58bd854296e54033f449435db3baf913cc5ba4f97f3" }, - "version": "1.2.0" + "version": "1.1.1" }, "androidx.compose.runtime:runtime-saveable:aar": { "shasums": { - "jar": "15e4adbb3091b06c9f47635a558244e8c8ef3e616c3a3b3192e524aa3bbfbcf0" + "jar": "15b542e07bea14065336da0b255650433da46e250a160feaf39b90f2edc8b230" }, - "version": "1.2.0" + "version": "1.1.1" }, "androidx.compose.runtime:runtime:aar": { "shasums": { - "jar": "0a49a51ce083ce5d282172d4e2509d792205dddbc652ea2aff061e507e546990" + "jar": "e075b3e3952cb3775e7acc7ccdb8f2de777da76bd6d2ea2cc1f96d6f57b37763" }, - "version": "1.2.0" + "version": "1.1.1" }, "androidx.compose.ui:ui-geometry:aar": { "shasums": { - "jar": "4b1ac2963e19147fae4f9f116690ff64f011137607fec429e40bcaa169d83bb4" + "jar": "4f1e34ae515af8c04e783275dded50bc8d156135fc35397fb1c81a9e01f173b3" }, - "version": "1.2.0" + "version": "1.1.1" }, "androidx.compose.ui:ui-graphics:aar": { "shasums": { - "jar": "58606617a8e71e58eba56bd79410c77c6df79017bb058cf64cce1def3af463de" + "jar": "e1719d8db7545e7f3be3baf42ac1865fb1cca36525d9b889601e2c2f4ea3aafc" }, - "version": "1.2.0" + "version": "1.1.1" }, "androidx.compose.ui:ui-text:aar": { "shasums": { - "jar": "8143d7e6bb293b81e404331a35ba5b749cfa8ac1c45c07bbe260261d0a83b3b7" + "jar": "e4af67f79b658862e4d7437f243033ed64334fbbff3247d4df39785a1c2c75d4" }, - "version": "1.2.0" + "version": "1.1.1" }, "androidx.compose.ui:ui-unit:aar": { "shasums": { - "jar": "09184bed04f3e13c73f90d0087ec3ec1f92832191b8e4494fc3c68a4b179d2a3" + "jar": "35b1d8f7f460874dde09fd7e630cd44052913695298076fc62de91a4fe1345a7" }, - "version": "1.2.0" + "version": "1.1.1" }, "androidx.compose.ui:ui-util:aar": { "shasums": { - "jar": "0cfc6911f25c76388f0e8ed567cf5cb19619f7a07fe3f9d6236f0b7866263c40" + "jar": "56420281f21e2888145ec9438ca4a632012792013b667da9aa03ea733e482e96" }, - "version": "1.2.0" + "version": "1.1.1" }, "androidx.compose.ui:ui:aar": { "shasums": { - "jar": "499cadfff85f101632da3369d49fce148c44d6d1e39b6b1a8c73bd5083022472" + "jar": "f0243d6a2176c9bcb6f077e1212cbc890943391ec9a6e32a4f249ab7c2c807a6" }, - "version": "1.2.0" + "version": "1.1.1" }, "androidx.concurrent:concurrent-futures": { "shasums": { @@ -220,9 +220,9 @@ }, "androidx.core:core-ktx:aar": { "shasums": { - "jar": "5964cfe7a4882da2a00fb6ca3d3a072d04139208186f7bc4b3cb66022764fc42" + "jar": "070cc5f8864f449128a2f4b25ca5b67aa3adca3ee1bd611e2eaf1a18fad83178" }, - "version": "1.5.0" + "version": "1.1.0" }, "androidx.core:core:aar": { "shasums": { @@ -236,12 +236,6 @@ }, "version": "1.0.0" }, - "androidx.customview:customview-poolingcontainer:aar": { - "shasums": { - "jar": "3584102fc49bf399c56e3b7be4bfe12000c46112320cd8cf85cc0a8f93f3e752" - }, - "version": "1.0.0" - }, "androidx.customview:customview:aar": { "shasums": { "jar": "01f76ab043770a97b054046f9815717b82ce0355c02967d16c61981359dc189a" @@ -304,9 +298,9 @@ }, "androidx.fragment:fragment:aar": { "shasums": { - "jar": "fdd0eac80c6b26c79093a63fc699303f928cc1fa73ca7196d5590a77eb6d6873" + "jar": "12f0831b4f08092d5dda272c1923c11a022ff20ceffed3e801751e21bb8d1c1e" }, - "version": "1.2.0" + "version": "1.3.6" }, "androidx.interpolator:interpolator:aar": { "shasums": { @@ -322,9 +316,9 @@ }, "androidx.lifecycle:lifecycle-common": { "shasums": { - "jar": "20ad1520f625cf455e6afd7290988306d3a9886efa993e0860fbabf4bb3f7bda" + "jar": "15848fb56db32f4c7cdc72b324003183d52a4884d6bf09be708ac7f587d139b5" }, - "version": "2.4.0" + "version": "2.3.1" }, "androidx.lifecycle:lifecycle-common-java8": { "shasums": { @@ -484,9 +478,9 @@ }, "androidx.profileinstaller:profileinstaller:aar": { "shasums": { - "jar": "0a1b2260af67962f4038d56fa84cda341315704aad56abbcf3a9b3bba6945426" + "jar": "d85f562bc70f33595b46a893c22d64f5b4f856c19a02b1eb09aad00c3a2124ee" }, - "version": "1.2.0" + "version": "1.1.0" }, "androidx.recyclerview:recyclerview:aar": { "shasums": { @@ -508,15 +502,15 @@ }, "androidx.savedstate:savedstate-ktx:aar": { "shasums": { - "jar": "43112928d3cbb108801ee11130f303404bc4892cf78908811568195107bba7fe" + "jar": "e44d61347463b0fafeeb649cbcc3d7109b2eb5e11d1522e986105170cdebbf68" }, - "version": "1.2.0" + "version": "1.1.0" }, "androidx.savedstate:savedstate:aar": { "shasums": { - "jar": "2de528d6898e95ef020d22d9ffdf9d1f77cbdd93f92d39dfaa5d5c43b0c311c8" + "jar": "d60bbe44c2c08083a17c5dc678a6d6b4d0a2d664858016ab5c049cbea90a63b7" }, - "version": "1.2.0" + "version": "1.1.0" }, "androidx.sqlite:sqlite-framework:aar": { "shasums": { @@ -532,9 +526,9 @@ }, "androidx.startup:startup-runtime:aar": { "shasums": { - "jar": "e0a6329a371262fe4c450372b70fdaf33b769ef6917094723787cfce896b1dd3" + "jar": "ff081d2db7dd28aec59f74934c514fbaf4ae5aac5258495fe10d612a3622f876" }, - "version": "1.1.1" + "version": "1.0.0" }, "androidx.test.espresso:espresso-accessibility:aar": { "shasums": { @@ -1958,13 +1952,17 @@ "androidx.vectordrawable:vectordrawable:aar" ], "androidx.appcompat:appcompat:aar": [ + "androidx.activity:activity:aar", "androidx.annotation:annotation", "androidx.appcompat:appcompat-resources:aar", "androidx.collection:collection", "androidx.core:core:aar", "androidx.cursoradapter:cursoradapter:aar", "androidx.drawerlayout:drawerlayout:aar", - "androidx.fragment:fragment:aar" + "androidx.fragment:fragment:aar", + "androidx.lifecycle:lifecycle-runtime:aar", + "androidx.lifecycle:lifecycle-viewmodel:aar", + "androidx.savedstate:savedstate:aar" ], "androidx.arch.core:core-common": [ "androidx.annotation:annotation" @@ -2009,12 +2007,10 @@ ], "androidx.compose.foundation:foundation-layout:aar": [ "androidx.annotation:annotation", - "androidx.compose.animation:animation-core:aar", "androidx.compose.runtime:runtime:aar", "androidx.compose.ui:ui-unit:aar", "androidx.compose.ui:ui-util:aar", "androidx.compose.ui:ui:aar", - "androidx.core:core:aar", "org.jetbrains.kotlin:kotlin-stdlib-common" ], "androidx.compose.foundation:foundation:aar": [ @@ -2089,8 +2085,7 @@ "androidx.compose.ui:ui-util:aar", "androidx.core:core:aar", "org.jetbrains.kotlin:kotlin-stdlib", - "org.jetbrains.kotlin:kotlin-stdlib-common", - "org.jetbrains.kotlinx:kotlinx-coroutines-core" + "org.jetbrains.kotlin:kotlin-stdlib-common" ], "androidx.compose.ui:ui-unit:aar": [ "androidx.annotation:annotation", @@ -2105,7 +2100,6 @@ "androidx.compose.ui:ui:aar": [ "androidx.annotation:annotation", "androidx.autofill:autofill:aar", - "androidx.collection:collection", "androidx.compose.runtime:runtime-saveable:aar", "androidx.compose.runtime:runtime:aar", "androidx.compose.ui:ui-geometry:aar", @@ -2113,13 +2107,11 @@ "androidx.compose.ui:ui-text:aar", "androidx.compose.ui:ui-unit:aar", "androidx.compose.ui:ui-util:aar", - "androidx.core:core:aar", - "androidx.customview:customview-poolingcontainer:aar", "androidx.lifecycle:lifecycle-common-java8", "androidx.lifecycle:lifecycle-runtime:aar", "androidx.lifecycle:lifecycle-viewmodel:aar", "androidx.profileinstaller:profileinstaller:aar", - "androidx.savedstate:savedstate-ktx:aar", + "androidx.savedstate:savedstate:aar", "org.jetbrains.kotlin:kotlin-stdlib", "org.jetbrains.kotlin:kotlin-stdlib-common", "org.jetbrains.kotlinx:kotlinx-coroutines-android", @@ -2156,10 +2148,6 @@ "androidx.cursoradapter:cursoradapter:aar": [ "androidx.annotation:annotation" ], - "androidx.customview:customview-poolingcontainer:aar": [ - "androidx.core:core-ktx:aar", - "org.jetbrains.kotlin:kotlin-stdlib" - ], "androidx.customview:customview:aar": [ "androidx.annotation:annotation", "androidx.collection:collection", @@ -2215,12 +2203,14 @@ "androidx.fragment:fragment:aar": [ "androidx.activity:activity:aar", "androidx.annotation:annotation", + "androidx.annotation:annotation-experimental:aar", "androidx.collection:collection", "androidx.core:core:aar", "androidx.lifecycle:lifecycle-livedata-core:aar", "androidx.lifecycle:lifecycle-viewmodel-savedstate:aar", "androidx.lifecycle:lifecycle-viewmodel:aar", "androidx.loader:loader:aar", + "androidx.savedstate:savedstate:aar", "androidx.viewpager:viewpager:aar" ], "androidx.interpolator:interpolator:aar": [ @@ -2381,8 +2371,7 @@ "androidx.savedstate:savedstate:aar": [ "androidx.annotation:annotation", "androidx.arch.core:core-common", - "androidx.lifecycle:lifecycle-common", - "org.jetbrains.kotlin:kotlin-stdlib" + "androidx.lifecycle:lifecycle-common" ], "androidx.sqlite:sqlite-framework:aar": [ "androidx.annotation:annotation", @@ -3360,7 +3349,6 @@ "androidx.compose.compiler:compiler": [ "androidx.compose.compiler.plugins.kotlin", "androidx.compose.compiler.plugins.kotlin.analysis", - "androidx.compose.compiler.plugins.kotlin.inference", "androidx.compose.compiler.plugins.kotlin.lower", "androidx.compose.compiler.plugins.kotlin.lower.decoys" ], @@ -6782,7 +6770,6 @@ "androidx.core:core-ktx:aar", "androidx.core:core:aar", "androidx.cursoradapter:cursoradapter:aar", - "androidx.customview:customview-poolingcontainer:aar", "androidx.customview:customview:aar", "androidx.databinding:databinding-adapters:aar", "androidx.databinding:databinding-common", @@ -7101,7 +7088,6 @@ "androidx.core:core-ktx:aar", "androidx.core:core:aar", "androidx.cursoradapter:cursoradapter:aar", - "androidx.customview:customview-poolingcontainer:aar", "androidx.customview:customview:aar", "androidx.databinding:databinding-adapters:aar", "androidx.databinding:databinding-common", @@ -7420,7 +7406,6 @@ "androidx.core:core-ktx:aar", "androidx.core:core:aar", "androidx.cursoradapter:cursoradapter:aar", - "androidx.customview:customview-poolingcontainer:aar", "androidx.customview:customview:aar", "androidx.databinding:databinding-adapters:aar", "androidx.databinding:databinding-common", @@ -7739,7 +7724,6 @@ "androidx.core:core-ktx:aar", "androidx.core:core:aar", "androidx.cursoradapter:cursoradapter:aar", - "androidx.customview:customview-poolingcontainer:aar", "androidx.customview:customview:aar", "androidx.databinding:databinding-adapters:aar", "androidx.databinding:databinding-common", diff --git a/third_party/versions.bzl b/third_party/versions.bzl index 69877e68d0b..7a54e5b49e7 100644 --- a/third_party/versions.bzl +++ b/third_party/versions.bzl @@ -21,17 +21,17 @@ https://github.com/oppia/oppia-android/wiki/Updating-Maven-Dependencies # This list should contain only production (non-test) dependencies. MAVEN_PRODUCTION_DEPENDENCY_VERSIONS = { "androidx.annotation:annotation": "1.1.0", - "androidx.appcompat:appcompat": "1.2.0", + "androidx.appcompat:appcompat": "1.3.1", "androidx.constraintlayout:constraintlayout": "1.1.3", "androidx.activity:activity-compose": "1.4.0", "androidx.core:core": "1.0.1", "androidx.core:core-ktx": "1.0.1", - "androidx.compose.compiler:compiler": "1.2.0", - "androidx.compose.foundation:foundation": "1.2.0", - "androidx.compose.foundation:foundation-layout": "1.2.0", - "androidx.compose.material:material": "1.2.0", - "androidx.compose.runtime:runtime": "1.2.0", - "androidx.compose.ui:ui": "1.2.0", + "androidx.compose.compiler:compiler": "1.1.1", + "androidx.compose.foundation:foundation": "1.1.1", + "androidx.compose.foundation:foundation-layout": "1.1.1", + "androidx.compose.material:material": "1.1.1", + "androidx.compose.runtime:runtime": "1.1.1", + "androidx.compose.ui:ui": "1.1.1", "androidx.databinding:databinding-adapters": "3.4.2", "androidx.databinding:databinding-common": "3.4.2", "androidx.databinding:databinding-compiler": "3.4.2", @@ -85,7 +85,7 @@ MAVEN_PRODUCTION_DEPENDENCY_VERSIONS = { "nl.dionsegijn:konfetti": "1.2.5", "org.checkerframework:checker-compat-qual": "2.5.5", "org.checkerframework:checker-qual": "3.21.3", - "org.jetbrains.kotlin:kotlin-stdlib-jdk8:jar": "1.3.72", + "org.jetbrains.kotlin:kotlin-stdlib-jdk8:jar": "1.6.10", "org.jetbrains.kotlinx:kotlinx-coroutines-android": "1.6.4", "org.jetbrains.kotlinx:kotlinx-coroutines-core": "1.6.4", "org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm": "1.6.4",