Skip to content

Commit

Permalink
Merge branch 'upgrade-to-kotlin1.6' into add-build-stats-ci-workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
BenHenning committed May 22, 2024
2 parents c2fee1b + da57feb commit 32733a0
Show file tree
Hide file tree
Showing 32 changed files with 63 additions and 74 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ WORKSPACE @oppia/android-app-infrastructure-reviewers
.bazelrc @oppia/android-app-infrastructure-reviewers
.bazelversion @oppia/android-app-infrastructure-reviewers
/tools/android/ @oppia/android-app-infrastructure-reviewers
/tools/kotlin/ @oppia/android-app-infrastructure-reviewers

# Configurations for Bazel-built Android App Bundles.
/bundle_config.pb.json @oppia/android-dev-workflow-reviewers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class AdministratorControlsActivity :
if (fragment is ProfileEditFragment) {
administratorControlsActivityPresenter.handleOnBackPressed()
} else {
@Suppress("DEPRECATION") // TODO: Fix this properly or file a bug.
@Suppress("DEPRECATION") // TODO(#5404): Migrate to a back pressed dispatcher.
super.onBackPressed()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class AppVersionActivity : InjectableAutoLocalizedAppCompatActivity() {

override fun onOptionsItemSelected(item: MenuItem): Boolean {
if (item.itemId == android.R.id.home) {
@Suppress("DEPRECATION") // TODO: Fix this properly or file a bug.
@Suppress("DEPRECATION") // TODO(#5404): Migrate to a back pressed dispatcher.
onBackPressed()
}
return super.onOptionsItemSelected(item)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ProfileAndDeviceIdActivity : InjectableAutoLocalizedAppCompatActivity() {

override fun onOptionsItemSelected(item: MenuItem): Boolean {
if (item.itemId == android.R.id.home) {
@Suppress("DEPRECATION") // TODO: Fix this properly or file a bug.
@Suppress("DEPRECATION") // TODO(#5404): Migrate to a back pressed dispatcher.
onBackPressed()
}
return super.onOptionsItemSelected(item)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class MarkChaptersCompletedActivity : InjectableAutoLocalizedAppCompatActivity()

override fun onOptionsItemSelected(item: MenuItem): Boolean {
if (item.itemId == android.R.id.home) {
@Suppress("DEPRECATION") // TODO: Fix this properly or file a bug.
@Suppress("DEPRECATION") // TODO(#5404): Migrate to a back pressed dispatcher.
onBackPressed()
}
return super.onOptionsItemSelected(item)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class MarkStoriesCompletedActivity : InjectableAutoLocalizedAppCompatActivity()

override fun onOptionsItemSelected(item: MenuItem): Boolean {
if (item.itemId == android.R.id.home) {
@Suppress("DEPRECATION") // TODO: Fix this properly or file a bug.
@Suppress("DEPRECATION") // TODO(#5404): Migrate to a back pressed dispatcher.
onBackPressed()
}
return super.onOptionsItemSelected(item)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class MarkTopicsCompletedActivity : InjectableAutoLocalizedAppCompatActivity() {

override fun onOptionsItemSelected(item: MenuItem): Boolean {
if (item.itemId == android.R.id.home) {
@Suppress("DEPRECATION") // TODO: Fix this properly or file a bug.
@Suppress("DEPRECATION") // TODO(#5404): Migrate to a back pressed dispatcher.
onBackPressed()
}
return super.onOptionsItemSelected(item)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class OptionsActivity :
selectedFragment = if (savedInstanceState == null) {
READING_TEXT_SIZE_FRAGMENT
} else {
@Suppress("DEPRECATION") // TODO: Fix this properly or file a bug.
@Suppress("DEPRECATION") // TODO(#5405): Ensure the correct type is being retrieved.
savedInstanceState.get(SELECTED_FRAGMENT_SAVED_KEY) as String
}
val extraOptionsTitle =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ReadingTextSizeActivityPresenter @Inject constructor(
private fun setToolbar() {
val readingTextSizeToolbar: Toolbar = activity.findViewById(R.id.reading_text_size_toolbar)
readingTextSizeToolbar.setNavigationOnClickListener {
@Suppress("DEPRECATION") // TODO: Fix this properly or file a bug.
@Suppress("DEPRECATION") // TODO(#5404): Migrate to a back pressed dispatcher.
activity.onBackPressed()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class ExplorationActivityPresenter @Inject constructor(
}

binding.explorationToolbar.setNavigationOnClickListener {
@Suppress("DEPRECATION") // TODO: Fix this properly or file a bug.
@Suppress("DEPRECATION") // TODO(#5404): Migrate to a back pressed dispatcher.
activity.onBackPressed()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ class StateFragmentPresenter @Inject constructor(
activity.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
inputManager.hideSoftInputFromWindow(
fragment.view!!.windowToken,
@Suppress("DEPRECATION") // TODO: Fix this properly or file a bug.
@Suppress("DEPRECATION") // TODO(#5406): Use the correct constant value here.
InputMethodManager.SHOW_FORCED
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ResumeLessonActivityPresenter @Inject constructor(
activity.setSupportActionBar(resumeLessonToolbar)

resumeLessonToolbar.setNavigationOnClickListener {
@Suppress("DEPRECATION") // TODO: Fix this properly or file a bug.
@Suppress("DEPRECATION") // TODO(#5404): Migrate to a back pressed dispatcher.
activity.onBackPressed()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class ProfileEditActivity : InjectableAutoLocalizedAppCompatActivity() {
override fun onBackPressed() {
val isMultipane = intent.extras!!.getBoolean(IS_MULTIPANE_EXTRA_KEY, false)
if (isMultipane) {
@Suppress("DEPRECATION") // TODO: Fix this properly or file a bug.
@Suppress("DEPRECATION") // TODO(#5404): Migrate to a back pressed dispatcher.
super.onBackPressed()
} else {
val intent = Intent(this, ProfileListActivity::class.java)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ProfileEditActivityPresenter @Inject constructor(

toolbar.setNavigationOnClickListener {
if (isMultipane) {
@Suppress("DEPRECATION") // TODO: Fix this properly or file a bug.
@Suppress("DEPRECATION") // TODO(#5404): Migrate to a back pressed dispatcher.
activity.onBackPressed()
} else {
val intent = Intent(activity, ProfileListActivity::class.java)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ class SurveyFragmentPresenter @Inject constructor(
activity.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
inputManager.hideSoftInputFromWindow(
fragment.view!!.windowToken,
@Suppress("DEPRECATION") // TODO: Fix this properly or file a bug.
@Suppress("DEPRECATION") // TODO(#5406): Use the correct constant value here.
InputMethodManager.SHOW_FORCED
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package org.oppia.android.app.testing
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.view.View
import androidx.databinding.DataBindingUtil
import org.oppia.android.R
import org.oppia.android.app.activity.ActivityComponentImpl
Expand Down Expand Up @@ -60,12 +59,9 @@ class FractionInputInteractionViewTestActivity :
)
writtenTranslationContext = params.writtenTranslationContext
binding.fractionInteractionViewModel = fractionInteractionViewModel
}

/** Checks submit-time errors. */
@Suppress("UNUSED_PARAMETER") // TODO: Fix this properly or file a bug.
fun getPendingAnswerErrorOnSubmitClick(v: View) {
fractionInteractionViewModel.checkPendingAnswerError(AnswerErrorCategory.SUBMIT_TIME)
binding.getPendingAnswerErrorOnSubmitClick = Runnable {
fractionInteractionViewModel.checkPendingAnswerError(AnswerErrorCategory.SUBMIT_TIME)
}
}

override fun onPendingAnswerErrorOrAvailabilityCheck(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package org.oppia.android.app.testing
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.view.View
import androidx.databinding.DataBindingUtil
import org.oppia.android.R
import org.oppia.android.app.activity.ActivityComponentImpl
Expand Down Expand Up @@ -71,15 +70,10 @@ class RatioInputInteractionViewTestActivity :
writtenTranslationContext = params.writtenTranslationContext

binding.ratioInteractionInputViewModel = ratioExpressionInputInteractionViewModel
}

/**
* Checks for submit time errors.
*/
@Suppress("UNUSED_PARAMETER") // TODO: Fix this properly or file a bug.
fun getPendingAnswerErrorOnSubmitClick(v: View) {
ratioExpressionInputInteractionViewModel
.checkPendingAnswerError(AnswerErrorCategory.SUBMIT_TIME)
binding.getPendingAnswerErrorOnSubmitClick = Runnable {
ratioExpressionInputInteractionViewModel
.checkPendingAnswerError(AnswerErrorCategory.SUBMIT_TIME)
}
}

override fun onAnswerReadyForSubmission(answer: UserAnswer) { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class TestFontScaleConfigurationUtilActivity : InjectableAutoLocalizedAppCompatA
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
(activityComponent as ActivityComponentImpl).inject(this)
@Suppress("DEPRECATION") // TODO: Fix this properly or file a bug.
@Suppress("DEPRECATION") // TODO(#5405): Ensure the correct type is being retrieved.
val readingTextSize = checkNotNull(
intent.getSerializableExtra(FONT_SCALE_EXTRA_KEY) as? ReadingTextSize
) { "Expected $FONT_SCALE_EXTRA_KEY to be in intent extras." }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.oppia.android.app.testing

import android.os.Bundle
import android.view.View
import androidx.databinding.DataBindingUtil
import org.oppia.android.R
import org.oppia.android.app.activity.ActivityComponentImpl
Expand Down Expand Up @@ -51,12 +50,9 @@ class TextInputInteractionViewTestActivity :

writtenTranslationContext = WrittenTranslationContext.getDefaultInstance()
binding.textInputViewModel = textInputViewModel
}

/** Checks submit-time errors. */
@Suppress("UNUSED_PARAMETER") // TODO: Fix this properly or file a bug.
fun getPendingAnswerErrorOnSubmitClick(v: View) {
textInputViewModel.checkPendingAnswerError(AnswerErrorCategory.SUBMIT_TIME)
binding.getPendingAnswerErrorOnSubmitClick = Runnable {
textInputViewModel.checkPendingAnswerError(AnswerErrorCategory.SUBMIT_TIME)
}
}

override fun onPendingAnswerErrorOrAvailabilityCheck(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ class TopicPracticeFragment : InjectableFragment() {
var selectedSkillId = HashMap<Int, MutableList<String>>()
if (savedInstanceState != null) {
selectedIdList = savedInstanceState.getIntegerArrayList(SUBTOPIC_ID_LIST_ARGUMENT_KEY)!!
// TODO(#4437): Convert this to a type-safe proto.
@Suppress("DEPRECATION") // TODO: Fix this properly or file a bug.
// TODO(#4986): Convert this to a type-safe proto.
@Suppress("DEPRECATION") // TODO(#5405): Ensure the correct type is being retrieved.
@Suppress("UNCHECKED_CAST") // Not quite safe.
selectedSkillId = savedInstanceState
.getSerializable(SKILL_ID_LIST_ARGUMENT_KEY)!! as HashMap<Int, MutableList<String>>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class QuestionPlayerActivityPresenter @Inject constructor(
activity.setSupportActionBar(binding.questionPlayerToolbar)

binding.questionPlayerToolbar.setNavigationOnClickListener {
@Suppress("DEPRECATION") // TODO: Fix this properly or file a bug.
@Suppress("DEPRECATION") // TODO(#5404): Migrate to a back pressed dispatcher.
activity.onBackPressed()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ class QuestionPlayerFragmentPresenter @Inject constructor(
activity.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
inputManager.hideSoftInputFromWindow(
fragment.view!!.windowToken,
@Suppress("DEPRECATION") // TODO: Fix this properly or file a bug.
@Suppress("DEPRECATION") // TODO(#5406): Use the correct constant value here.
InputMethodManager.SHOW_FORCED
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class WalkthroughFinalFragmentPresenter @Inject constructor(
}

override fun goBack() {
@Suppress("DEPRECATION") // TODO: Fix this properly or file a bug.
@Suppress("DEPRECATION") // TODO(#5404): Migrate to a back pressed dispatcher.
activity.onBackPressed()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
<variable
name="fractionInteractionViewModel"
type="org.oppia.android.app.player.state.itemviewmodel.FractionInteractionViewModel" />

<variable
name="getPendingAnswerErrorOnSubmitClick"
type="java.lang.Runnable" />
</data>

<ScrollView
Expand Down Expand Up @@ -67,7 +71,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:onClick="getPendingAnswerErrorOnSubmitClick"
android:onClick="@{(v) -> getPendingAnswerErrorOnSubmitClick.run()}"
android:text="@string/submit_button_text"
android:textColor="@color/component_color_shared_secondary_4_text_color" />
</LinearLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
<variable
name="ratioInteractionInputViewModel"
type="org.oppia.android.app.player.state.itemviewmodel.RatioExpressionInputInteractionViewModel" />

<variable
name="getPendingAnswerErrorOnSubmitClick"
type="java.lang.Runnable" />
</data>

<ScrollView
Expand Down Expand Up @@ -67,7 +71,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:onClick="getPendingAnswerErrorOnSubmitClick"
android:onClick="@{(v) -> getPendingAnswerErrorOnSubmitClick.run()}"
android:text="@string/submit_button_text"
android:textColor="@color/component_color_shared_secondary_4_text_color" />
</LinearLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
<variable
name="textInputViewModel"
type="org.oppia.android.app.player.state.itemviewmodel.TextInputViewModel" />

<variable
name="getPendingAnswerErrorOnSubmitClick"
type="java.lang.Runnable" />
</data>

<ScrollView
Expand Down Expand Up @@ -67,7 +71,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:onClick="getPendingAnswerErrorOnSubmitClick"
android:onClick="@{(v) -> getPendingAnswerErrorOnSubmitClick.run()}"
android:text="@string/submit_button_text"
android:textColor="@color/component_color_shared_secondary_4_text_color" />
</LinearLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ class AnalyticsController @Inject constructor(
.addEventLogsToUpload(eventLog)
.build()
} else {
// TODO(#1433): Refactoring for logging exceptions to both console and exception loggers.
val exception =
IllegalStateException("Least Recent Event index absent -- EventLogCacheStoreSize is 0")
consoleLogger.e("AnalyticsController", "Failure while caching event.", exception)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ class PerformanceMetricsController @Inject constructor(
.addOppiaMetricLog(oppiaMetricLog)
.build()
} else {
// TODO(#1433): Refactoring for logging exceptions to both console and exception loggers.
val exception =
IllegalStateException(
"Least Recent Event index absent -- MetricLogStorageCacheSize is 0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ class ExceptionsController @Inject constructor(
.addExceptionLog(exceptionLog)
.build()
} else {
// TODO(#1433): Refactoring for logging exceptions to both console and exception loggers.
val exception =
NullPointerException(
"Least Recent Exception index absent -- ExceptionLogCacheStoreSize is 0"
)
consoleLogger.e(EXCEPTIONS_CONTROLLER, exception.toString())
exceptionLogger.logException(exception)
}
}
return@storeDataAsync oppiaExceptionLogs.toBuilder().addExceptionLog(exceptionLog).build()
Expand Down
Loading

0 comments on commit 32733a0

Please sign in to comment.