mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2025-01-28 15:39:32 +01:00
improved activity divider drawing
This commit is contained in:
parent
0cae282645
commit
b5e8f98f18
@ -542,17 +542,12 @@ public abstract class AbsActivitiesFragment<Data> extends AbsContentListRecycler
|
||||
|
||||
@Override
|
||||
protected boolean isDividerEnabled(int childPos) {
|
||||
// Don't draw for last item
|
||||
if (childPos == RecyclerView.NO_POSITION || childPos == adapter.getItemCount() - 1) {
|
||||
return false;
|
||||
}
|
||||
final int itemViewType = adapter.getItemViewType(childPos);
|
||||
if (itemViewType == AbsActivitiesAdapter.ITEM_VIEW_TYPE_EMPTY) {
|
||||
//
|
||||
if (childPos != 0 && shouldUseDividerFor(adapter.getItemViewType(childPos + 1))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// Draw only if current item and next item is TITLE_SUMMARY
|
||||
if (shouldUseDividerFor(itemViewType)) {
|
||||
if (shouldUseDividerFor(adapter.getItemViewType(childPos + 1))) {
|
||||
return true;
|
||||
@ -562,8 +557,7 @@ public abstract class AbsActivitiesFragment<Data> extends AbsContentListRecycler
|
||||
}
|
||||
|
||||
private boolean shouldUseDividerFor(int itemViewType) {
|
||||
return itemViewType != AbsActivitiesAdapter.ITEM_VIEW_TYPE_STATUS
|
||||
&& itemViewType != AbsActivitiesAdapter.ITEM_VIEW_TYPE_EMPTY;
|
||||
return itemViewType == AbsActivitiesAdapter.ITEM_VIEW_TYPE_TITLE_SUMMARY;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user