Skip to content

Commit

Permalink
Fixes part of #4120, part of #1051: Fix a lot of build-time warnings (#…
Browse files Browse the repository at this point in the history
…5402)

## Explanation
Fixes part of #4120
Fixes part of #1051

Similar to #5400, this brings forward changes that would otherwise go in
#4937 to simplify the transition to Kotlin 1.6.

Part of #4937 is introducing warnings-as-errors for both Kotlin and Java
in order to reduce developer error, simplify the codebase, and minimize
warnings when building (which can result in developer habits of ignoring
warnings that might have real consequences to end users of the app). In
order to keep the main migration PR smaller, this PR fixes all existing
warnings and any new ones detected with the Kotlin 1.6 compiler that are
not tied to Kotlin 1.5/1.6 API changes (those are part of #4937,
instead). Fortunately, most of the changes could be brought forward into
this PR.

Specific things to note:
- A few new issues were filed for SDK 33 deprecations caused, but not
noted by, #5222): #5404, #5405, and #5406 and corresponding TODOs added.
This PR opts for TODOs over actual fixes to minimize the amount of
manual verification needed, and to try and keep the PR more focused on
non-functional refactor changes (to reduce the risk as reverting this PR
may be difficult if an issue is introduced).
- A lot of the fixes were removing redundant casts or null checks.
- The old mechanism we used for view models is deprecated, and had a lot
of problems (partially documented in #1051). This PR moves the codebase
over to directly injecting view models instead of using the view model
provider (thus getting rid of true Jetpack view models entirely in the
codebase).
- We never used the Jetpack functionality, and we were leaking a lot of
context objects that could theoretically result in memory leaks.
- The migration of view models in this way has already been ongoing in
the codebase; this PR just finishes moving the rest of them over to
remove the deprecated JetPack view model reference.
- Note that this doesn't actually change the scope of the view models,
and in fact they should largely behave as they always have.
- ``ObservableViewModel`` was subsequently updated, and may be something
we could remove in the future now that it's no longer a Jetpack view
model.
- The old view model binding code was removed, along with its test file
exemptions. It's no longer used now that the view models have been
finished being migrated over to direct injection.
- Some of the binding adapters didn't correctly correspond to their
namespaced properties. I _think_ that the databinding compiler was still
hooking them up correctly, but they produced build warnings that have
now been addressed (specifically, 'app' is implied). Some other
properties were using unusual namespaces, so these were replaced with
'app' versions for consistency & correctness.
- Some cases where SAM interfaces could be converted to lambdas were
also addressed (mainly for ``Observer`` callbacks in UI code).
- ``DrawerLayout.setDrawerListener`` was replaced with calls to
``DrawerLayout.addDrawerListener`` since the former [is
deprecated](https://developer.android.com/reference/androidx/drawerlayout/widget/DrawerLayout#setDrawerListener(androidx.drawerlayout.widget.DrawerLayout.DrawerListener)).
This isn't expected to have a functional difference.
- Some other minor control flow warnings were addressed (such as dead
code paths).
- ``when`` cases were updated to be comprehensive (as this is enforced
starting in newer versions of Kotlin even for non-result based ``when``
statements).
- Some unused variables were removed and/or replaced with ``_`` per
Kotlin convention.
- Some parameter names needed to be updated to match their override
signatures.
- One change in ``ExitSurveyConfirmationDialogFragment`` involved
removing parsing a profile ID. Technically this is a semantic change
since now a crash isn't going to happen if the profile ID is missing or
incorrect, but that seems fine since the fragment doesn't even need a
profile ID to be passed.
- Some of the test activities were updated to bind a ``Runnable``
callback rather than binding to a method (just to avoid passing the
unused ``View`` parameter and to keep things a bit simple binding-wise).
- Some cases were fixed where variables were being shadowed due to
reused names in deeper scopes.
- There were some typing issues going on in tests with custom test
application components. This has been fixed by explicitly declaring the
application component types rather than them being implicit within the
generated Dagger code.
- ``getDrawable`` calls were updated to pass in a ``Theme`` since the
non-theme version is deprecated.
- Some Java property references were updated, too (i.e. using property
syntax instead of Java getters when referencing Java code in Kotlin).
- In some cases, deprecated APIs were suppressed since they're needed
for testing purposes.
- Mockito's ``verifyZeroInteractions`` has been deprecated in favor of
``verifyNoMoreInteractions``, so updates were made in tests accordingly.
- ``ExperimentalCoroutinesApi`` and ``InternalCoroutinesApi`` have been
deprecated in favor of a newer ``OptIn`` method (which can actually be
done via kotlinc arguments, but not in this PR). Thus, they've been
outright removed in cases where not needed, and otherwise migrated to
the ``OptIn`` approach where they do need to be declared.
- In some cases, Kotlin recommends using a ``toSet()`` conversion for
iterable operations when it's more performant, so some of those cases
(where noticed) have been addressed.
- Some unused parameter cases needed to be suppressed for situations
when Robolectric is using reflection to access them.
- In some cases Android Studio would recommend transformation chain
simplifications; these were adopted where obvious.
- There are a few new TODOs added on #3616 as well, to clean up
deprecated references that have been suppressed in this PR.
- ``BundleExtensions`` was updated to implement its own version of the
type-based ``getSerializable`` until such time as ``BundleCompat`` can
be used, instead (per #5405).
- A **lot** of nullability improvements needed to happen throughout the
JSON asset loading process since there was a lot of loose typing
happening there.
- Some Kotlin & OkHttp deprecated API references were also updated to
use their non-deprecated replacements.
- ``NetworkLoggingInterceptorTest`` was majorly reworked to ensure that
the assertions would actually run (``runBlockingTest`` was being used
which is deprecated, and something I try to avoid since it's very
difficult to write tests that use it correctly). My investigations
showed that the assertions weren't being called, so these tests would
never fail. The new versions will always run the assertions or fail
before reaching them, and fortunately the code under test passes the
assertions correctly. Ditto for ``ConsoleLoggerTest``.
- Some parts of ``SurveyProgressController`` were reworked to have
better typing management and to reduce the need for nullability
management.
- Some generic typing trickiness needed to be fixed ahead of the Kotlin
version upgrade in ``UrlImageParser``. See file comments & links in
those comments for more context.
- ``BundleExtensionsTest`` had to be changed since
``getSerializableExtra`` is now deprecated. We also can't update the
test to run SDK 33 since that requires upgrading Robolectric, and
Robolectric can't be upgraded without upgrading other dependencies that
eventually lead to needing to upgrade both Kotlin and Bazel (so it's a
non-starter; this is a workaround until we can actually move to a newer
version of Robolectric).
- There was some minor code-deduplication & cleanup done in
``ClickableAreasImage``.
- Some incorrect comments were removed in tests (to the effect of "using
not-allowed-listed variables should result in a failure."). These seemed
to have been copied from an earlier test, but the later tests weren't
actually verifying that behavior so the comment wasn't correct.
- An unused method was removed from ``ConceptCardRetriever``
(``createWrittenTranslationFromJson``) and some other small
cleanup/consolidation work happened in that class.
- Some stylistic changes were done in ``TopicController`` for JSON
loading to better manage nullable situations, and to try and make the
JSON loading code slightly more Kotlin idiomatic.

Note that overall the PR has relied **heavily** on tooling to detect
warnings to fix, and automated tests to verify that the changes have no
side effects.

Note also that this PR does not actually enable warnings-as-errors; that
will happen in a downstream PR.

## Essential Checklist
- [x] The PR title and explanation each start with "Fix #bugnum: " (If
this PR fixes part of an issue, prefix the title with "Fix part of
#bugnum: ...".)
- [x] Any changes to
[scripts/assets](https://github.com/oppia/oppia-android/tree/develop/scripts/assets)
files have their rationale included in the PR explanation.
- [x] The PR follows the [style
guide](https://github.com/oppia/oppia-android/wiki/Coding-style-guide).
- [x] The PR does not contain any unnecessary code changes from Android
Studio
([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#undo-unnecessary-changes)).
- [x] The PR is made from a branch that's **not** called "develop" and
is up-to-date with "develop".
- [x] The PR is **assigned** to the appropriate reviewers
([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#clarification-regarding-assignees-and-reviewers-section)).

## For UI-specific PRs only
N/A -- While this changes UI code, it should change very few UI
behaviors and only failure cases for those it does affect. It's largely
infrastructural-only and falls mainly under refactoring/cleanup work.

---------

Co-authored-by: Adhiambo Peres <[email protected]>
Co-authored-by: Sean Lip <[email protected]>
  • Loading branch information
3 people authored Jun 3, 2024
1 parent 3c7713d commit 3a369ed
Show file tree
Hide file tree
Showing 311 changed files with 1,274 additions and 1,351 deletions.
1 change: 0 additions & 1 deletion app/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,6 @@ kt_android_library(
"//app/src/main/java/org/oppia/android/app/utility/math:math_expression_accessibility_util",
"//app/src/main/java/org/oppia/android/app/viewmodel:observable_array_list",
"//app/src/main/java/org/oppia/android/app/viewmodel:observable_view_model",
"//app/src/main/java/org/oppia/android/app/viewmodel:view_model_provider",
"//domain",
"//domain/src/main/java/org/oppia/android/domain/audio:audio_player_controller",
"//domain/src/main/java/org/oppia/android/domain/clipboard:clipboard_controller",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ class AdministratorControlsActivity :
if (fragment is ProfileEditFragment) {
administratorControlsActivityPresenter.handleOnBackPressed()
} else {
@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 @@ -3,7 +3,6 @@ package org.oppia.android.app.administratorcontrols
import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar
import androidx.databinding.DataBindingUtil
import org.oppia.android.R
import org.oppia.android.app.activity.ActivityScope
Expand Down Expand Up @@ -62,14 +61,11 @@ class AdministratorControlsActivityPresenter @Inject constructor(
if (isMultipane) {
val adminControlsActivity = activity as AdministratorControlsActivity
when (lastLoadedFragment) {
PROFILE_LIST_FRAGMENT -> (activity as AdministratorControlsActivity).loadProfileList()
APP_VERSION_FRAGMENT -> (activity as AdministratorControlsActivity).loadAppVersion()
PROFILE_LIST_FRAGMENT -> activity.loadProfileList()
APP_VERSION_FRAGMENT -> activity.loadAppVersion()
PROFILE_EDIT_FRAGMENT -> selectedProfileId.let { profileId ->
if (extraControlsTitle != null) {
(activity as AdministratorControlsActivity).loadProfileEdit(
profileId = profileId,
profileName = extraControlsTitle
)
activity.loadProfileEdit(profileId = profileId, profileName = extraControlsTitle)
if (isProfileDeletionDialogVisible && profileId != 0) {
val fragment = activity.supportFragmentManager.findFragmentById(
R.id.administrator_controls_fragment_multipane_placeholder
Expand All @@ -88,7 +84,7 @@ class AdministratorControlsActivityPresenter @Inject constructor(

/** Sets up the navigation drawer. */
private fun setUpNavigationDrawer() {
val toolbar = binding.administratorControlsActivityToolbar as Toolbar
val toolbar = binding.administratorControlsActivityToolbar
activity.setSupportActionBar(toolbar)
activity.supportActionBar!!.setDisplayShowHomeEnabled(true)
navigationDrawerFragment = activity
Expand Down Expand Up @@ -206,9 +202,9 @@ class AdministratorControlsActivityPresenter @Inject constructor(
outState.putString(SELECTED_CONTROLS_TITLE_SAVED_KEY, titleTextView.text.toString())
}
outState.putString(LAST_LOADED_FRAGMENT_EXTRA_KEY, lastLoadedFragment)
isProfileDeletionDialogVisible?.let {
isProfileDeletionDialogVisible.let {
outState.putBoolean(IS_PROFILE_DELETION_DIALOG_VISIBLE_KEY, it)
}
selectedProfileId?.let { outState.putInt(SELECTED_PROFILE_ID_SAVED_KEY, it) }
selectedProfileId.let { outState.putInt(SELECTED_PROFILE_ID_SAVED_KEY, it) }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class AppVersionActivity : InjectableAutoLocalizedAppCompatActivity() {

override fun onOptionsItemSelected(item: MenuItem): Boolean {
if (item.itemId == android.R.id.home) {
@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 @@ -5,15 +5,14 @@ import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import org.oppia.android.app.fragment.FragmentScope
import org.oppia.android.app.viewmodel.ViewModelProvider
import org.oppia.android.databinding.AppVersionFragmentBinding
import javax.inject.Inject

/** The presenter for [AppVersionFragment]. */
@FragmentScope
class AppVersionFragmentPresenter @Inject constructor(
private val fragment: Fragment,
private val viewModelProvider: ViewModelProvider<AppVersionViewModel>
private val appVersionViewModel: AppVersionViewModel
) {
private lateinit var binding: AppVersionFragmentBinding

Expand All @@ -26,12 +25,8 @@ class AppVersionFragmentPresenter @Inject constructor(
)
binding.let {
it.lifecycleOwner = fragment
it.viewModel = getAppVersionViewModel()
it.viewModel = appVersionViewModel
}
return binding.root
}

private fun getAppVersionViewModel(): AppVersionViewModel {
return viewModelProvider.getForFragment(fragment, AppVersionViewModel::class.java)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class ProfileAndDeviceIdActivity : InjectableAutoLocalizedAppCompatActivity() {

override fun onOptionsItemSelected(item: MenuItem): Boolean {
if (item.itemId == android.R.id.home) {
@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 @@ -8,7 +8,6 @@ import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.GridLayoutManager
import org.oppia.android.R
import org.oppia.android.app.recyclerview.BindableAdapter
import org.oppia.android.app.viewmodel.ViewModelProvider
import org.oppia.android.databinding.CompletedStoryItemBinding
import org.oppia.android.databinding.CompletedStoryListFragmentBinding
import javax.inject.Inject
Expand All @@ -17,7 +16,7 @@ import javax.inject.Inject
class CompletedStoryListFragmentPresenter @Inject constructor(
private val activity: AppCompatActivity,
private val fragment: Fragment,
private val viewModelProvider: ViewModelProvider<CompletedStoryListViewModel>,
private val viewModel: CompletedStoryListViewModel,
private val singleTypeBuilderFactory: BindableAdapter.SingleTypeBuilder.Factory
) {

Expand All @@ -29,7 +28,6 @@ class CompletedStoryListFragmentPresenter @Inject constructor(
container: ViewGroup?,
internalProfileId: Int
): View? {
val viewModel = getCompletedStoryListViewModel()
viewModel.setProfileId(internalProfileId)

binding = CompletedStoryListFragmentBinding
Expand Down Expand Up @@ -61,8 +59,4 @@ class CompletedStoryListFragmentPresenter @Inject constructor(
)
.build()
}

private fun getCompletedStoryListViewModel(): CompletedStoryListViewModel {
return viewModelProvider.getForFragment(fragment, CompletedStoryListViewModel::class.java)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
public final class AppCompatCheckBoxBindingAdapters {
/** Sets the button tint for the specified checkbox, via data-binding. */
@BindingAdapter("app:buttonTint")
@BindingAdapter("buttonTint")
public static void setButtonTint(@NonNull AppCompatCheckBox checkBox, @ColorInt int colorRgb) {
CompoundButtonCompat.setButtonTintList(checkBox, ColorStateList.valueOf(colorRgb));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public final class CircularProgressIndicatorAdapters {
* @param progress the numerical progress to set on the indicator (which will be displayed based
* on the indicator's customized minimum and maximum progress values)
*/
@BindingAdapter("app:animatedProgress")
@BindingAdapter("animatedProgress")
public static void setAnimatedProgress(CircularProgressIndicator indicator, int progress) {
if (progress > 0) {
indicator.setProgressCompat(progress, /* animated = */ true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
public final class ConstraintLayoutAdapters {

/** Binding adapter for setting a layout_constraintEnd_toEndOf to a view. */
@BindingAdapter("app:layout_constraintEnd_toEndOf")
@BindingAdapter("layout_constraintEnd_toEndOf")
public static void setConstraintEndToEndOf(@NonNull View view, int constraintToId) {
ConstraintLayout constraintLayout = (ConstraintLayout) view.getParent();
ConstraintSet constraintSet = new ConstraintSet();
Expand All @@ -20,7 +20,7 @@ public static void setConstraintEndToEndOf(@NonNull View view, int constraintToI
}

/** Binding adapter for setting layout_constraintHorizontal_bias to a view. */
@BindingAdapter("app:layout_constraintHorizontal_bias")
@BindingAdapter("layout_constraintHorizontal_bias")
public static void setHorizontalBias(@NonNull View view, float value) {
ConstraintLayout constraintLayout = (ConstraintLayout) view.getParent();
ConstraintSet constraintSet = new ConstraintSet();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static void setBackgroundColor(@NonNull View view, @ColorInt int colorRgb
}

/** Used to set a rounded-rect background drawable with a data-bound color. */
@BindingAdapter("app:roundedRectDrawableWithColor")
@BindingAdapter("roundedRectDrawableWithColor")
public static void setBackgroundDrawable(@NonNull View view, @ColorInt int colorRgb) {
view.setBackgroundResource(R.drawable.rounded_rect_background);
// The input color needs to have alpha channel prepended to it.
Expand All @@ -29,7 +29,7 @@ public static void setBackgroundDrawable(@NonNull View view, @ColorInt int color
}

/** Used to set a top rounded-rect background drawable with a data-bound color. */
@BindingAdapter("app:topRoundedRectDrawableWithColor")
@BindingAdapter("topRoundedRectDrawableWithColor")
public static void setTopBackgroundDrawable(@NonNull View view, @ColorInt int colorRgb) {
view.setBackgroundResource(R.drawable.top_rounded_rect_background);
// The input color needs to have alpha channel prepended to it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
public final class EditTextBindingAdapters {

/** Binding adapter for setting a [TextWatcher] as a change listener for an [EditText]. */
@BindingAdapter("app:textChangedListener")
@BindingAdapter("textChangedListener")
public static void bindTextWatcher(@NonNull EditText editText, TextWatcher textWatcher) {
editText.addTextChangedListener(textWatcher);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
public final class GuidelineBindingAdapters {

/** Binding adapter for setting the `guidePercent` for a [Guideline]. */
@BindingAdapter("app:layout_constraintGuide_percent")
@BindingAdapter("layout_constraintGuide_percent")
public static void setGuidelinePercentage(@NonNull Guideline guideline, float percentage) {
ConstraintLayout.LayoutParams params =
(ConstraintLayout.LayoutParams) guideline.getLayoutParams();
Expand All @@ -18,7 +18,7 @@ public static void setGuidelinePercentage(@NonNull Guideline guideline, float pe
}

/** Binding adapter for setting the `guideEnd` for a [Guideline]. */
@BindingAdapter("app:layout_constraintGuide_end")
@BindingAdapter("layout_constraintGuide_end")
public static void setConstraintGuidelineEnd(@NonNull Guideline guideline, float guideEndPx) {
ConstraintLayout.LayoutParams params =
(ConstraintLayout.LayoutParams) guideline.getLayoutParams();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@

/** Holds all custom binding adapters that bind to [ImageView]. */
public final class ImageViewBindingAdapters {
@BindingAdapter("app:srcCompat")
@BindingAdapter("srcCompat")
public static void setImageDrawableCompat(
@NonNull ImageView imageView,
@DrawableRes int drawableResourceId
) {
imageView.setImageResource(drawableResourceId);
}

@BindingAdapter("app:srcCompat")
@BindingAdapter("srcCompat")
public static void setImageDrawableCompat(
@NonNull ImageView imageView,
Drawable drawable
Expand All @@ -40,7 +40,7 @@ public static void setImageDrawableCompat(
* @param imageView view where the profile avatar will be loaded into
* @param profileAvatar represents either a colorId or local image uri
*/
@BindingAdapter("profile:src")
@BindingAdapter("profileImageSource")
public static void setProfileImage(ImageView imageView, ProfileAvatar profileAvatar) {
if (profileAvatar != null) {
if (profileAvatar.getAvatarTypeCase() == ProfileAvatar.AvatarTypeCase.AVATAR_COLOR_RGB) {
Expand Down Expand Up @@ -86,7 +86,7 @@ public boolean onResourceReady(
* <p/>
* Reference: https://stackoverflow.com/a/35809319/3689782.
*/
@BindingAdapter("playState:image")
@BindingAdapter("playStateImage")
public static void setPlayStateDrawable(
@NonNull ImageView imageView,
ChapterPlayState chapterPlayState
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
public final class MarginBindingAdapters {

/** Sets the start margin for a view, accounting for RTL scenarios. */
@BindingAdapter("app:layoutMarginStart")
@BindingAdapter("layoutMarginStart")
public static void setLayoutMarginStart(@NonNull View view, float marginStart) {
if (view.getLayoutParams() instanceof MarginLayoutParams) {
MarginLayoutParams params = (MarginLayoutParams) view.getLayoutParams();
Expand All @@ -20,7 +20,7 @@ public static void setLayoutMarginStart(@NonNull View view, float marginStart) {
}

/** Sets the end margin for a view, accounting for RTL scenarios. */
@BindingAdapter("app:layoutMarginEnd")
@BindingAdapter("layoutMarginEnd")
public static void setLayoutMarginEnd(@NonNull View view, float marginEnd) {
if (view.getLayoutParams() instanceof MarginLayoutParams) {
MarginLayoutParams params = (MarginLayoutParams) view.getLayoutParams();
Expand All @@ -30,7 +30,7 @@ public static void setLayoutMarginEnd(@NonNull View view, float marginEnd) {
}

/** Used to set a margin-top for views. */
@BindingAdapter("app:layoutMarginTop")
@BindingAdapter("layoutMarginTop")
public static void setLayoutMarginTop(@NonNull View view, float marginTop) {
if (view.getLayoutParams() instanceof MarginLayoutParams) {
MarginLayoutParams params = (MarginLayoutParams) view.getLayoutParams();
Expand All @@ -41,7 +41,7 @@ public static void setLayoutMarginTop(@NonNull View view, float marginTop) {
}

/** Used to set a margin-bottom for views. */
@BindingAdapter("app:layoutMarginBottom")
@BindingAdapter("layoutMarginBottom")
public static void setLayoutMarginBottom(@NonNull View view, float marginBottom) {
if (view.getLayoutParams() instanceof MarginLayoutParams) {
MarginLayoutParams params = (MarginLayoutParams) view.getLayoutParams();
Expand All @@ -52,7 +52,7 @@ public static void setLayoutMarginBottom(@NonNull View view, float marginBottom)
}

/** Used to set a margin for views. */
@BindingAdapter("app:layoutMargin")
@BindingAdapter("layoutMargin")
public static void setLayoutMargin(@NonNull View view, float margin) {
if (view.getLayoutParams() instanceof MarginLayoutParams) {
MarginLayoutParams params = (MarginLayoutParams) view.getLayoutParams();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ public final class StateAssemblerMarginBindingAdapters {
/** Used to set a margin for exploration split-view. */
@BindingAdapter(
value = {
"app:explorationSplitViewMarginApplicable",
"app:explorationSplitViewMarginStart",
"app:explorationSplitViewMarginTop",
"app:explorationSplitViewMarginEnd",
"app:explorationSplitViewMarginBottom",
"explorationSplitViewMarginApplicable",
"explorationSplitViewMarginStart",
"explorationSplitViewMarginTop",
"explorationSplitViewMarginEnd",
"explorationSplitViewMarginBottom",
},
requireAll = false
)
Expand All @@ -36,11 +36,11 @@ public static void setExplorationSplitViewMargin(
/** Used to set a margin for exploration view. */
@BindingAdapter(
value = {
"app:explorationViewMarginApplicable",
"app:explorationViewMarginStart",
"app:explorationViewMarginTop",
"app:explorationViewMarginEnd",
"app:explorationViewMarginBottom",
"explorationViewMarginApplicable",
"explorationViewMarginStart",
"explorationViewMarginTop",
"explorationViewMarginEnd",
"explorationViewMarginBottom",
},
requireAll = false
)
Expand All @@ -58,11 +58,11 @@ public static void setExplorationViewMargin(
/** Used to set a margin for question view. */
@BindingAdapter(
value = {
"app:questionViewMarginApplicable",
"app:questionViewMarginStart",
"app:questionViewMarginTop",
"app:questionViewMarginEnd",
"app:questionViewMarginBottom",
"questionViewMarginApplicable",
"questionViewMarginStart",
"questionViewMarginTop",
"questionViewMarginEnd",
"questionViewMarginBottom",
},
requireAll = false
)
Expand All @@ -80,11 +80,11 @@ public static void setQuestionViewMargin(
/** Used to set a margin for question split-view. */
@BindingAdapter(
value = {
"app:questionSplitViewMarginApplicable",
"app:questionSplitViewMarginStart",
"app:questionSplitViewMarginTop",
"app:questionSplitViewMarginEnd",
"app:questionSplitViewMarginBottom",
"questionSplitViewMarginApplicable",
"questionSplitViewMarginStart",
"questionSplitViewMarginTop",
"questionSplitViewMarginEnd",
"questionSplitViewMarginBottom",
},
requireAll = false
)
Expand Down
Loading

0 comments on commit 3a369ed

Please sign in to comment.