Hide item decorators for hidden items

This commit is contained in:
M66B 2019-04-04 08:09:00 +02:00
parent c499ff8f0a
commit f0bdc40d7b
1 changed files with 9 additions and 1 deletions

View File

@ -310,7 +310,15 @@ public class FragmentMessages extends FragmentBase {
LinearLayoutManager llm = new LinearLayoutManager(getContext());
rvMessage.setLayoutManager(llm);
DividerItemDecoration itemDecorator = new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL);
DividerItemDecoration itemDecorator = new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL) {
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
if (view.findViewById(R.id.clItem).getVisibility() == View.GONE)
outRect.setEmpty();
else
super.getItemOffsets(outRect, view, parent, state);
}
};
itemDecorator.setDrawable(getContext().getDrawable(R.drawable.divider));
rvMessage.addItemDecoration(itemDecorator);