From 6dd764e8b59e68fd8bd3c54bfcd8560f4a880195 Mon Sep 17 00:00:00 2001 From: Sergei Shchurov Date: Wed, 18 Oct 2023 00:02:42 +0300 Subject: [PATCH 1/3] change AppCompatCheckBoxBindingAdapters and AppCompatCheckBoxBindingAdaptersTest to avoid restricted API error --- .../app/databinding/AppCompatCheckBoxBindingAdapters.java | 8 ++++++-- .../databinding/AppCompatCheckBoxBindingAdaptersTest.kt | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/oppia/android/app/databinding/AppCompatCheckBoxBindingAdapters.java b/app/src/main/java/org/oppia/android/app/databinding/AppCompatCheckBoxBindingAdapters.java index b704faa86e2..c1077c61ce3 100644 --- a/app/src/main/java/org/oppia/android/app/databinding/AppCompatCheckBoxBindingAdapters.java +++ b/app/src/main/java/org/oppia/android/app/databinding/AppCompatCheckBoxBindingAdapters.java @@ -1,18 +1,22 @@ package org.oppia.android.app.databinding; import android.content.res.ColorStateList; + import androidx.annotation.ColorInt; import androidx.annotation.NonNull; import androidx.appcompat.widget.AppCompatCheckBox; +import androidx.core.widget.CompoundButtonCompat; import androidx.databinding.BindingAdapter; /** * Custom data-binding adapters for {@link AppCompatCheckBox}s. */ public final class AppCompatCheckBoxBindingAdapters { - /** Sets the button tint for the specified checkbox, via data-binding. */ + /** + * Sets the button tint for the specified checkbox, via data-binding. + */ @BindingAdapter("app:buttonTint") public static void setButtonTint(@NonNull AppCompatCheckBox checkBox, @ColorInt int colorRgb) { - checkBox.setSupportButtonTintList(ColorStateList.valueOf(colorRgb)); + CompoundButtonCompat.setButtonTintList(checkBox, ColorStateList.valueOf(colorRgb)); } } diff --git a/app/src/sharedTest/java/org/oppia/android/app/databinding/AppCompatCheckBoxBindingAdaptersTest.kt b/app/src/sharedTest/java/org/oppia/android/app/databinding/AppCompatCheckBoxBindingAdaptersTest.kt index 57586237166..9fcf2bd1e47 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/databinding/AppCompatCheckBoxBindingAdaptersTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/databinding/AppCompatCheckBoxBindingAdaptersTest.kt @@ -127,7 +127,7 @@ class AppCompatCheckBoxBindingAdaptersTest { activityRule.scenario.onActivity { val appCompatCheckBox: AppCompatCheckBox = getAppCompatCheckBox(it) setButtonTint(appCompatCheckBox, colorRgb) - assertThat(appCompatCheckBox.supportButtonTintList?.defaultColor).isEqualTo(colorRgb) + assertThat(appCompatCheckBox.buttonTintList?.defaultColor).isEqualTo(colorRgb) } } From 6f15cd12e3ad09a6df11c948e728fbf3a5066d49 Mon Sep 17 00:00:00 2001 From: Sergei Shchurov Date: Wed, 18 Oct 2023 00:06:12 +0300 Subject: [PATCH 2/3] remove extra separation in import group --- .../app/databinding/AppCompatCheckBoxBindingAdapters.java | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/java/org/oppia/android/app/databinding/AppCompatCheckBoxBindingAdapters.java b/app/src/main/java/org/oppia/android/app/databinding/AppCompatCheckBoxBindingAdapters.java index c1077c61ce3..bf3db3d747c 100644 --- a/app/src/main/java/org/oppia/android/app/databinding/AppCompatCheckBoxBindingAdapters.java +++ b/app/src/main/java/org/oppia/android/app/databinding/AppCompatCheckBoxBindingAdapters.java @@ -1,7 +1,6 @@ package org.oppia.android.app.databinding; import android.content.res.ColorStateList; - import androidx.annotation.ColorInt; import androidx.annotation.NonNull; import androidx.appcompat.widget.AppCompatCheckBox; From 1dbd88297a80c4daa0ab32d628f521b47ad7d311 Mon Sep 17 00:00:00 2001 From: Sergei Shchurov Date: Fri, 20 Oct 2023 19:59:04 +0300 Subject: [PATCH 3/3] reformat single line KDocs --- .../app/databinding/AppCompatCheckBoxBindingAdapters.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/src/main/java/org/oppia/android/app/databinding/AppCompatCheckBoxBindingAdapters.java b/app/src/main/java/org/oppia/android/app/databinding/AppCompatCheckBoxBindingAdapters.java index bf3db3d747c..4e7f59b0bb3 100644 --- a/app/src/main/java/org/oppia/android/app/databinding/AppCompatCheckBoxBindingAdapters.java +++ b/app/src/main/java/org/oppia/android/app/databinding/AppCompatCheckBoxBindingAdapters.java @@ -11,9 +11,7 @@ * Custom data-binding adapters for {@link AppCompatCheckBox}s. */ public final class AppCompatCheckBoxBindingAdapters { - /** - * Sets the button tint for the specified checkbox, via data-binding. - */ + /** Sets the button tint for the specified checkbox, via data-binding. */ @BindingAdapter("app:buttonTint") public static void setButtonTint(@NonNull AppCompatCheckBox checkBox, @ColorInt int colorRgb) { CompoundButtonCompat.setButtonTintList(checkBox, ColorStateList.valueOf(colorRgb));