Skip to content

Commit 422c316

Browse files
committed
fix gift reordering offset in profile gifts
1 parent f2908b1 commit 422c316

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎TMessagesProj/src/main/java/org/telegram/ui/Gifts/ProfileGiftsContainer.java‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,11 +312,16 @@ public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.
312312
}
313313
final int fromPosition = viewHolder.getAdapterPosition();
314314
final int toPosition = target.getAdapterPosition();
315+
final int fromIndex = list.gifts.indexOf(getSavedGift(viewHolder));
316+
final int toIndex = list.gifts.indexOf(getSavedGift(target));
317+
if (fromIndex < 0 || toIndex < 0) {
318+
return false;
319+
}
315320
if (isCollection) {
316-
list.reorder(fromPosition, toPosition);
321+
list.reorder(fromIndex, toIndex);
317322
parent.collections.updateIcon(list.collectionId);
318323
} else {
319-
list.reorderPinned(fromPosition, toPosition);
324+
list.reorderPinned(fromIndex, toIndex);
320325
}
321326
listView.adapter.notifyItemMoved(fromPosition, toPosition);
322327
listView.adapter.updateWithoutNotify();

0 commit comments

Comments
 (0)