|
|
|
|
7
|
public class ComponentPresenterBase {
|
7
|
public class ComponentPresenterBase {
|
8
|
public void applyTopInsets(@NonNull View view, int topInsets) {
|
8
|
public void applyTopInsets(@NonNull View view, int topInsets) {
|
9
|
MarginLayoutParams lp = (MarginLayoutParams) view.getLayoutParams();
|
9
|
MarginLayoutParams lp = (MarginLayoutParams) view.getLayoutParams();
|
10
|
- if (lp.topMargin != topInsets) {
|
|
|
|
|
10
|
+ if (lp != null && lp.topMargin != topInsets) {
|
11
|
lp.topMargin = topInsets;
|
11
|
lp.topMargin = topInsets;
|
12
|
view.requestLayout();
|
12
|
view.requestLayout();
|
13
|
}
|
13
|
}
|
|
|
|
|
15
|
|
15
|
|
16
|
public void applyBottomInset(@NonNull View view, int bottomInset) {
|
16
|
public void applyBottomInset(@NonNull View view, int bottomInset) {
|
17
|
MarginLayoutParams lp = (MarginLayoutParams) view.getLayoutParams();
|
17
|
MarginLayoutParams lp = (MarginLayoutParams) view.getLayoutParams();
|
18
|
- if (lp.bottomMargin!= bottomInset) {
|
|
|
|
|
18
|
+ if (lp != null && lp.bottomMargin!= bottomInset) {
|
19
|
lp.bottomMargin = bottomInset;
|
19
|
lp.bottomMargin = bottomInset;
|
20
|
view.requestLayout();
|
20
|
view.requestLayout();
|
21
|
}
|
21
|
}
|