-
Notifications
You must be signed in to change notification settings - Fork 503
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Translated StateAssemblerMarginBindingAdapters
- Loading branch information
Showing
3 changed files
with
107 additions
and
163 deletions.
There are no files selected for viewing
107 changes: 107 additions & 0 deletions
107
app/src/main/java/org/oppia/app/databinding/StateAssemblerMarginBindingAdapters.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
package org.oppia.app.databinding; | ||
|
||
import android.view.View; | ||
import android.view.ViewGroup.MarginLayoutParams; | ||
import androidx.databinding.BindingAdapter; | ||
|
||
public class StateAssemblerMarginBindingAdapters { | ||
/** Used to set a margin for exploration split-view. */ | ||
@BindingAdapter( | ||
"app:explorationSplitViewMarginApplicable", | ||
"app:explorationSplitViewMarginStart", | ||
"app:explorationSplitViewMarginTop", | ||
"app:explorationSplitViewMarginEnd", | ||
"app:explorationSplitViewMarginBottom", | ||
requireAll = false | ||
) | ||
public static void setExplorationSplitViewMargin( | ||
View view, | ||
Boolean isApplicable, | ||
Float marginStart, | ||
Float marginTop, | ||
Float marginEnd, | ||
Float marginBottom | ||
) { | ||
setMarginIfApplicable(view, isApplicable, marginStart, marginTop, marginEnd, marginBottom); | ||
} | ||
|
||
/** Used to set a margin for exploration view. */ | ||
@BindingAdapter( | ||
"app:explorationViewMarginApplicable", | ||
"app:explorationViewMarginStart", | ||
"app:explorationViewMarginTop", | ||
"app:explorationViewMarginEnd", | ||
"app:explorationViewMarginBottom", | ||
requireAll = false | ||
) | ||
public static void setExplorationViewMargin( | ||
View view, | ||
Boolean isApplicable, | ||
Float marginStart, | ||
Float marginTop, | ||
Float marginEnd, | ||
Float marginBottom | ||
) { | ||
setMarginIfApplicable(view, isApplicable, marginStart, marginTop, marginEnd, marginBottom); | ||
} | ||
|
||
/** Used to set a margin for question view. */ | ||
@BindingAdapter( | ||
"app:questionViewMarginApplicable", | ||
"app:questionViewMarginStart", | ||
"app:questionViewMarginTop", | ||
"app:questionViewMarginEnd", | ||
"app:questionViewMarginBottom", | ||
requireAll = false | ||
) | ||
public static void setQuestionViewMargin( | ||
View view, | ||
Boolean isApplicable, | ||
Float marginStart, | ||
Float marginTop, | ||
Float marginEnd, | ||
Float marginBottom | ||
) { | ||
setMarginIfApplicable(view, isApplicable, marginStart, marginTop, marginEnd, marginBottom); | ||
} | ||
|
||
/** Used to set a margin for question split-view. */ | ||
@BindingAdapter( | ||
"app:questionSplitViewMarginApplicable", | ||
"app:questionSplitViewMarginStart", | ||
"app:questionSplitViewMarginTop", | ||
"app:questionSplitViewMarginEnd", | ||
"app:questionSplitViewMarginBottom", | ||
requireAll = false | ||
) | ||
public static void setQuestionSplitViewMargin( | ||
View view, | ||
Boolean isApplicable, | ||
Float marginStart, | ||
Float marginTop, | ||
Float marginEnd, | ||
Float marginBottom | ||
) { | ||
setMarginIfApplicable(view, isApplicable, marginStart, marginTop, marginEnd, marginBottom); | ||
} | ||
|
||
private static void setMarginIfApplicable( | ||
View view, | ||
Boolean isApplicable, | ||
Float marginStart, | ||
Float marginTop, | ||
Float marginEnd, | ||
Float marginBottom | ||
) { | ||
if (isApplicable && view.getLayoutParams() instanceof MarginLayoutParams) { | ||
MarginLayoutParams params = (MarginLayoutParams) view.getLayoutParams(); | ||
params.setMargins( | ||
marginStart.intValue(), | ||
marginTop.intValue(), | ||
marginEnd.intValue(), | ||
marginBottom.intValue() | ||
); | ||
view.requestLayout(); | ||
} | ||
} | ||
} |
105 changes: 0 additions & 105 deletions
105
app/src/main/java/org/oppia/app/databinding/StateAssemblerMarginBindingAdapters.kt
This file was deleted.
Oops, something went wrong.
58 changes: 0 additions & 58 deletions
58
app/src/main/java/org/oppia/app/recyclerview/RecyclerViewBindingAdapter.kt
This file was deleted.
Oops, something went wrong.