Do not show the top shadow if it does not fit in portrait
This commit is contained in:
parent
b8f6a30575
commit
b1a68877f4
2 changed files with 14 additions and 6 deletions
|
@ -142,14 +142,12 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
|
|||
scrollView.requestLayout();
|
||||
}
|
||||
|
||||
// 8dp is the shadow height
|
||||
boolean showTopShadow = screenHeight - statusBarHeight - mainView.getHeight() >= AndroidUtils.dpToPx(activity, 8);
|
||||
if (AndroidUiHelper.isOrientationPortrait(activity)) {
|
||||
mainView.setBackgroundResource(getPortraitBgResId());
|
||||
mainView.setBackgroundResource(showTopShadow ? getPortraitBgResId() : getBgColorId());
|
||||
} else {
|
||||
if (screenHeight - statusBarHeight - mainView.getHeight() >= getResources().getDimension(R.dimen.bottom_sheet_content_padding_small)) {
|
||||
mainView.setBackgroundResource(getLandscapeTopsidesBgResId());
|
||||
} else {
|
||||
mainView.setBackgroundResource(getLandscapeSidesBgResId());
|
||||
}
|
||||
mainView.setBackgroundResource(showTopShadow ? getLandscapeTopsidesBgResId() : getLandscapeSidesBgResId());
|
||||
}
|
||||
|
||||
ViewTreeObserver obs = mainView.getViewTreeObserver();
|
||||
|
@ -176,6 +174,11 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
|
|||
|
||||
}
|
||||
|
||||
@ColorRes
|
||||
protected int getBgColorId() {
|
||||
return nightMode ? R.color.bg_color_dark : R.color.bg_color_light;
|
||||
}
|
||||
|
||||
@DrawableRes
|
||||
protected int getPortraitBgResId() {
|
||||
return nightMode ? R.drawable.bg_bottom_menu_dark : R.drawable.bg_bottom_menu_light;
|
||||
|
|
|
@ -144,6 +144,11 @@ public class AddWaypointBottomSheetDialogFragment extends MenuBottomSheetDialogF
|
|||
return getIcon(id, nightMode ? R.color.ctx_menu_direction_color_dark : R.color.map_widget_blue);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getBgColorId() {
|
||||
return nightMode ? R.color.ctx_menu_bg_dark : R.color.bg_color_light;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPortraitBgResId() {
|
||||
return nightMode ? R.drawable.bg_additional_menu_dark : R.drawable.bg_bottom_menu_light;
|
||||
|
|
Loading…
Reference in a new issue