Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/oppia#3843' into oppia#3843
Browse files Browse the repository at this point in the history
  • Loading branch information
XichengSpencer committed Dec 7, 2023
2 parents 40c44df + 582f69d commit 6824346
Show file tree
Hide file tree
Showing 61 changed files with 828 additions and 528 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ runs:
$ANDROID_HOME/cmdline-tools/tools/bin/sdkmanager --install "platform-tools"
shell: bash

- name: Install SDK 31
- name: Install SDK 33
run: |
$ANDROID_HOME/cmdline-tools/tools/bin/sdkmanager --install "platforms;android-31"
$ANDROID_HOME/cmdline-tools/tools/bin/sdkmanager --install "platforms;android-33"
shell: bash

- name: Install build tools 29.0.2
Expand Down
4 changes: 2 additions & 2 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,14 @@ package_group(
"flavor": "oppia",
"min_sdk_version": 21,
"multidex": "native",
"target_sdk_version": 31,
"target_sdk_version": 33,
},
{
"flavor": "oppia_kitkat",
"main_dex_list": "//:config/kitkat_main_dex_class_list.txt",
"min_sdk_version": 19,
"multidex": "manual_main_dex",
"target_sdk_version": 31,
"target_sdk_version": 33,
},
]
]
Expand Down
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ load("//third_party:versions.bzl", "HTTP_DEPENDENCY_VERSIONS", "get_maven_depend
# TODO(#1542): Sync Android SDK version with the manifest.
android_sdk_repository(
name = "androidsdk",
api_level = 31,
api_level = 33,
build_tools_version = "29.0.2",
)

Expand Down
5 changes: 3 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

android {
compileSdkVersion 31
compileSdkVersion 33
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "org.oppia.android"
minSdkVersion 19
targetSdkVersion 31
targetSdkVersion 33
versionCode 1
versionName "1.0"
multiDexEnabled true
Expand All @@ -23,6 +23,7 @@ android {
includeCompileClasspath true
}
}
vectorDrawables { useSupportLibrary true }
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AppAndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.oppia.android.app.ui">
<uses-sdk android:minSdkVersion="19"
android:targetSdkVersion="31" />
android:targetSdkVersion="33" />
</manifest>
2 changes: 1 addition & 1 deletion app/src/main/DatabindingAdaptersManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.oppia.android.databinding.adapters">
<uses-sdk android:minSdkVersion="19"
android:targetSdkVersion="31" />
android:targetSdkVersion="33" />
</manifest>
2 changes: 1 addition & 1 deletion app/src/main/DatabindingResourcesManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.oppia.android.app.databinding">
<uses-sdk android:minSdkVersion="19"
android:targetSdkVersion="31" />
android:targetSdkVersion="33" />
</manifest>
2 changes: 1 addition & 1 deletion app/src/main/RecyclerviewAdaptersManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.oppia.android.app.recyclerview.adapters">
<uses-sdk android:minSdkVersion="19"
android:targetSdkVersion="31" />
android:targetSdkVersion="33" />
</manifest>
2 changes: 1 addition & 1 deletion app/src/main/ViewModelManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.oppia.android.app.vm">
<uses-sdk android:minSdkVersion="19"
android:targetSdkVersion="31" />
android:targetSdkVersion="33" />
</manifest>
2 changes: 1 addition & 1 deletion app/src/main/ViewModelsManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.oppia.android.app.view.models">
<uses-sdk android:minSdkVersion="19"
android:targetSdkVersion="31" />
android:targetSdkVersion="33" />
</manifest>
2 changes: 1 addition & 1 deletion app/src/main/ViewsManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.oppia.android.app.views">
<uses-sdk android:minSdkVersion="19"
android:targetSdkVersion="31" />
android:targetSdkVersion="33" />
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import org.oppia.android.app.utility.lifecycle.LifecycleSafeTimerFactory
import org.oppia.android.app.view.ViewComponentFactory
import org.oppia.android.app.view.ViewComponentImpl
import org.oppia.android.domain.oppialogger.OppiaLogger
import org.oppia.android.util.platformparameter.EnableContinueButtonAnimation
import org.oppia.android.util.platformparameter.PlatformParameterValue
import org.oppia.android.util.system.OppiaClock
import javax.inject.Inject

Expand All @@ -25,12 +23,14 @@ class ContinueButtonView @JvmOverloads constructor(
defStyleAttr: Int = R.style.StateButtonActive
) : androidx.appcompat.widget.AppCompatButton(context, attrs, defStyleAttr) {

@field:[Inject EnableContinueButtonAnimation]
lateinit var enableContinueButtonAnimation: PlatformParameterValue<Boolean>
@Inject lateinit var fragment: Fragment
@Inject lateinit var oppiaClock: OppiaClock
@Inject lateinit var lifecycleSafeTimerFactory: LifecycleSafeTimerFactory
@Inject lateinit var oppiaLogger: OppiaLogger
@Inject
lateinit var fragment: Fragment
@Inject
lateinit var oppiaClock: OppiaClock
@Inject
lateinit var lifecycleSafeTimerFactory: LifecycleSafeTimerFactory
@Inject
lateinit var oppiaLogger: OppiaLogger

private var shouldAnimateContinueButtonLateinit: Boolean? = null
private val shouldAnimateContinueButton: Boolean
Expand Down Expand Up @@ -119,13 +119,11 @@ class ContinueButtonView @JvmOverloads constructor(

private fun startAnimating() {
val animation = AnimationUtils.loadAnimation(context, R.anim.wobble_button_animation)
if (enableContinueButtonAnimation.value) {
startAnimation(animation)
// Repeat the animation after a fixed interval.
lifecycleSafeTimerFactory.createTimer(INTERVAL_BETWEEN_CONTINUE_BUTTON_ANIM_MS)
.observe(fragment) {
startAnimating()
}
}
startAnimation(animation)
// Repeat the animation after a fixed interval.
lifecycleSafeTimerFactory.createTimer(INTERVAL_BETWEEN_CONTINUE_BUTTON_ANIM_MS)
.observe(fragment) {
startAnimating()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import org.oppia.android.app.help.faq.faqItemViewModel.FAQHeaderViewModel
import org.oppia.android.app.help.faq.faqItemViewModel.FAQItemViewModel
import org.oppia.android.app.translation.AppLanguageResourceHandler
import org.oppia.android.app.viewmodel.ObservableViewModel
import org.oppia.android.util.extensions.containsPlaceholderRegex
import javax.inject.Inject

/** View model in [FAQListFragment]. */
Expand All @@ -28,10 +29,11 @@ class FAQListViewModel @Inject constructor(

private fun retrieveQuestionsOrAnswers(questionsOrAnswers: List<String>): List<String> {
val appName = resourceHandler.getStringInLocale(R.string.app_name)
return questionsOrAnswers.mapIndexed { index, questionOrAnswer ->
if (index == QUESTION_INDEX_WITH_OPPIA_REFERENCE) {
resourceHandler.formatInLocaleWithWrapping(questionOrAnswer, appName)
} else questionOrAnswer

return questionsOrAnswers.map {
if (it.containsPlaceholderRegex())
resourceHandler.formatInLocaleWithWrapping(it, appName)
else it
}
}

Expand All @@ -40,8 +42,4 @@ class FAQListViewModel @Inject constructor(

private fun retrieveAnswers(): List<String> =
retrieveQuestionsOrAnswers(resourceHandler.getStringArrayInLocale(R.array.faq_answers))

private companion object {
private const val QUESTION_INDEX_WITH_OPPIA_REFERENCE = 3
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -286,25 +286,25 @@ class ExplorationActivityPresenter @Inject constructor(

fun stopExploration(isCompletion: Boolean) {
fontScaleConfigurationUtil.adjustFontScale(activity, ReadingTextSize.MEDIUM_TEXT_SIZE)
explorationDataController.stopPlayingExploration(isCompletion).toLiveData()
.observe(
activity,
{
when (it) {
is AsyncResult.Pending -> oppiaLogger.d("ExplorationActivity", "Stopping exploration")
is AsyncResult.Failure ->
oppiaLogger.e("ExplorationActivity", "Failed to stop exploration", it.error)
is AsyncResult.Success -> {
oppiaLogger.d("ExplorationActivity", "Successfully stopped exploration")
if (isCompletion) {
maybeShowSurveyDialog(profileId, topicId)
} else {
backPressActivitySelector()
}
}
explorationDataController.stopPlayingExploration(isCompletion).toLiveData().observe(activity) {
when (it) {
is AsyncResult.Pending ->
oppiaLogger.d("ExplorationActivity", "Stopping exploration")
is AsyncResult.Failure -> {
oppiaLogger.e("ExplorationActivity", "Failed to stop exploration", it.error)
// Allow the user to always exit if they get into a broken state.
backPressActivitySelector()
}
is AsyncResult.Success -> {
oppiaLogger.d("ExplorationActivity", "Successfully stopped exploration")
if (isCompletion) {
maybeShowSurveyDialog(profileId, topicId)
} else {
backPressActivitySelector()
}
}
)
}
}
}

fun onKeyboardAction(actionCode: Int) {
Expand Down
Loading

0 comments on commit 6824346

Please sign in to comment.