determine next display item using items list

closes sk22#815
This commit is contained in:
sk 2023-09-09 01:27:32 +02:00
parent 77dee59b9c
commit 58f0c07357
1 changed files with 4 additions and 3 deletions

View File

@ -397,10 +397,11 @@ public abstract class StatusDisplayItem{
} }
public Optional<StatusDisplayItem> getDisplayItemOffset(int offset){ public Optional<StatusDisplayItem> getDisplayItemOffset(int offset){
int nextPos=getAbsoluteAdapterPosition() + offset;
List<StatusDisplayItem> displayItems=item.parentFragment.getDisplayItems(); List<StatusDisplayItem> displayItems=item.parentFragment.getDisplayItems();
return displayItems.size() > nextPos int thisPos=displayItems.indexOf(item);
? Optional.of(displayItems.get(nextPos)) int offsetPos=thisPos + offset;
return displayItems.size() > offsetPos && thisPos >= 0 && offsetPos >= 0
? Optional.of(displayItems.get(offsetPos))
: Optional.empty(); : Optional.empty();
} }