Fix scroll items height only for favorites
This commit is contained in:
parent
459bd14370
commit
766858012e
1 changed files with 19 additions and 9 deletions
|
@ -549,15 +549,6 @@ public class AddPointBottomSheetDialog extends MenuBottomSheetDialogFragment {
|
|||
view.setOnClickListener(listener);
|
||||
Activity activity = getActivity();
|
||||
if (activity != null) {
|
||||
TextView title = view.findViewById(R.id.title);
|
||||
TextView description = view.findViewById(R.id.description);
|
||||
|
||||
int titleHeight = AndroidUtils.getTextHeight(title.getPaint());
|
||||
int descriptionHeight = AndroidUtils.getTextHeight(description.getPaint());
|
||||
int minTextHeight = titleHeight + descriptionHeight * 2;
|
||||
if (view.getHeight() < minTextHeight) {
|
||||
view.setMinimumHeight(minTextHeight);
|
||||
}
|
||||
RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) view.getLayoutParams();
|
||||
if (AndroidUiHelper.isOrientationPortrait(getActivity())) {
|
||||
layoutParams.width = (int) (AndroidUtils.getScreenWidth(activity) / 2.5);
|
||||
|
@ -593,6 +584,25 @@ public class AddPointBottomSheetDialog extends MenuBottomSheetDialogFragment {
|
|||
super(app, items);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int viewType) {
|
||||
RecyclerView.ViewHolder viewHolder = super.onCreateViewHolder(viewGroup, viewType);
|
||||
|
||||
TextView title = viewHolder.itemView.findViewById(R.id.title);
|
||||
TextView description = viewHolder.itemView.findViewById(R.id.description);
|
||||
if (title != null && description != null) {
|
||||
int titleHeight = AndroidUtils.getTextHeight(title.getPaint());
|
||||
int descriptionHeight = AndroidUtils.getTextHeight(description.getPaint());
|
||||
int minTextHeight = titleHeight + descriptionHeight * 2;
|
||||
if (viewHolder.itemView.getHeight() < minTextHeight) {
|
||||
viewHolder.itemView.setMinimumHeight(minTextHeight);
|
||||
}
|
||||
}
|
||||
|
||||
return viewHolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
OsmandApplication app = getApp();
|
||||
|
|
Loading…
Reference in a new issue