Apply top margin to the first entry if there are no groups

pull/735/head
Alexander Bakker 4 years ago
parent 5f737582fb
commit 9c907cf14a

@ -419,6 +419,7 @@ public class EntryListView extends Fragment implements EntryAdapter.Listener {
public void setGroups(TreeSet<String> groups) {
_groups = groups;
_groupChip.setVisibility(_groups.isEmpty() ? View.GONE : View.VISIBLE);
updateDividerDecoration();
}
private void updateDividerDecoration() {
@ -471,6 +472,10 @@ public class EntryListView extends Fragment implements EntryAdapter.Listener {
@Override
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
if (parent.getChildAdapterPosition(view) == 0 && (_groups == null || _groups.isEmpty())) {
// the first item should also have a top margin
outRect.top = _height;
}
outRect.bottom = _height;
}
}

Loading…
Cancel
Save