Skip to content

Commit

Permalink
Fix: Correct home screen topic grid misalignment after returning from…
Browse files Browse the repository at this point in the history
… lesson (#5150)
  • Loading branch information
TanishMoral11 committed Nov 2, 2024
1 parent 2ba2cbc commit 9a89bed
Showing 1 changed file with 2 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static void setLayoutMarginStart(@NonNull View view, float marginStart) {
if (view.getLayoutParams() instanceof MarginLayoutParams) {
MarginLayoutParams params = (MarginLayoutParams) view.getLayoutParams();
MarginLayoutParamsCompat.setMarginStart(params, (int) marginStart);
view.requestLayout();
view.setLayoutParams(params);
}
}

Expand All @@ -25,7 +25,7 @@ public static void setLayoutMarginEnd(@NonNull View view, float marginEnd) {
if (view.getLayoutParams() instanceof MarginLayoutParams) {
MarginLayoutParams params = (MarginLayoutParams) view.getLayoutParams();
MarginLayoutParamsCompat.setMarginEnd(params, (int) marginEnd);
view.requestLayout();
view.setLayoutParams(params);
}
}

Expand All @@ -36,7 +36,6 @@ public static void setLayoutMarginTop(@NonNull View view, float marginTop) {
MarginLayoutParams params = (MarginLayoutParams) view.getLayoutParams();
params.topMargin = (int) marginTop;
view.setLayoutParams(params);
view.requestLayout();
}
}

Expand All @@ -47,22 +46,6 @@ public static void setLayoutMarginBottom(@NonNull View view, float marginBottom)
MarginLayoutParams params = (MarginLayoutParams) view.getLayoutParams();
params.bottomMargin = (int) marginBottom;
view.setLayoutParams(params);
view.requestLayout();
}
}

/** Used to set a margin for views. */
@BindingAdapter("layoutMargin")
public static void setLayoutMargin(@NonNull View view, float margin) {
if (view.getLayoutParams() instanceof MarginLayoutParams) {
MarginLayoutParams params = (MarginLayoutParams) view.getLayoutParams();
params.setMargins(
(int) margin,
(int) margin,
(int) margin,
(int) margin
);
view.requestLayout();
}
}
}

0 comments on commit 9a89bed

Please sign in to comment.