Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,7 @@ public void setIsLongPressDragEnabled(boolean enabled) {
}

public void setSelectedEntry(VaultEntry entry) {
if (entry == null) {
_selectedEntry = null;
return;
}

if (!entry.isFavorite()) {
_selectedEntry = entry;
}
_selectedEntry = entry;
}

@Override
Expand Down Expand Up @@ -80,13 +73,21 @@ public int getMovementFlags(@NonNull RecyclerView recyclerView, @NonNull Recycle
@Override
public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder,
RecyclerView.ViewHolder target) {
int targetIndex = _adapter.translateEntryPosToIndex(target.getBindingAdapterPosition());
if (targetIndex < _adapter.getShownFavoritesCount()) {
int targetPosition = target.getBindingAdapterPosition();

if (_adapter.isPositionFooter(targetPosition) || _adapter.isPositionErrorCard(targetPosition)) {
return false;
}

VaultEntry sourceEntry = _adapter.getEntryAtPosition(viewHolder.getBindingAdapterPosition());
VaultEntry targetEntry = _adapter.getEntryAtPosition(targetPosition);

if (sourceEntry.isFavorite() != targetEntry.isFavorite()) {
return false;
}

int firstPosition = viewHolder.getLayoutPosition();
int secondPosition = target.getBindingAdapterPosition();
int secondPosition = targetPosition;

_adapter.onItemMove(firstPosition, secondPosition);
_positionChanged = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,6 @@ private boolean isEntryDraggable(VaultEntry entry) {
return entry != null
&& isDragAndDropAllowed()
&& _selectedEntries.size() == 1
&& !_selectedEntries.get(0).isFavorite()
&& _selectedEntries.get(0) == entry;
}

Expand Down