Fix bottomSheet height with expandableListView

This commit is contained in:
Chumva 2018-11-30 18:49:45 +02:00
parent c840cedc0f
commit 8193ed11d2
3 changed files with 11 additions and 2 deletions

View file

@ -179,7 +179,11 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
public void onGlobalLayout() {
final View contentView = useScrollableItemsContainer() ? mainView.findViewById(R.id.scroll_view) : itemsContainer;
if (contentView.getHeight() > contentHeight) {
contentView.getLayoutParams().height = contentHeight;
if (useScrollableItemsContainer()) {
contentView.getLayoutParams().height = contentHeight;
} else {
contentView.getLayoutParams().height = ViewGroup.LayoutParams.WRAP_CONTENT;
}
contentView.requestLayout();
}
@ -187,6 +191,9 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
boolean showTopShadow = screenHeight - statusBarHeight - mainView.getHeight() >= AndroidUtils.dpToPx(activity, 8);
if (AndroidUiHelper.isOrientationPortrait(activity)) {
mainView.setBackgroundResource(showTopShadow ? getPortraitBgResId() : getBgColorId());
if (!useScrollableItemsContainer() && !showTopShadow) {
mainView.setPadding(0, 0, 0, 0);
}
} else {
mainView.setBackgroundResource(showTopShadow ? getLandscapeTopsidesBgResId() : getLandscapeSidesBgResId());
}

View file

@ -188,7 +188,6 @@ public class AvoidRoadsBottomSheetDialogFragment extends MenuBottomSheetDialogFr
counter++;
}
}
private void populateImpassableRoadsTypes() {

View file

@ -182,6 +182,7 @@ public class ShowAlongTheRouteBottomSheet extends MenuBottomSheetDialogFragment
if (adapter != null) {
adapter.contentItem = getAdapterContentItems();
adapter.notifyDataSetChanged();
setupHeightAndBackground(getView());
}
}
@ -309,6 +310,7 @@ public class ShowAlongTheRouteBottomSheet extends MenuBottomSheetDialogFragment
}
if (isChecked) {
expListView.expandGroup(groupPosition);
setupHeightAndBackground(getView());
}
}
});
@ -322,6 +324,7 @@ public class ShowAlongTheRouteBottomSheet extends MenuBottomSheetDialogFragment
} else {
expListView.expandGroup(groupPosition);
}
setupHeightAndBackground(getView());
}
}
});