Skip to content
This repository has been archived by the owner on Feb 11, 2022. It is now read-only.

Commit

Permalink
Fix concurrent modification of adapter in dropbox sample
Browse files Browse the repository at this point in the history
Fixes #75
  • Loading branch information
spacecowboy committed Feb 24, 2016
1 parent 9880562 commit b7baea3
Showing 1 changed file with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public Loader<SortedList<DropboxAPI.Entry>> getLoader() {
@Override
public SortedList<DropboxAPI.Entry> loadInBackground() {
SortedList<DropboxAPI.Entry> files = new SortedList<>(DropboxAPI.Entry.class,
new SortedListAdapterCallback<DropboxAPI.Entry>(getAdapter()) {
new SortedListAdapterCallback<DropboxAPI.Entry>(null) {
@Override
public int compare(DropboxAPI.Entry lhs, DropboxAPI.Entry rhs) {
if (isDir(lhs) && !isDir(rhs)) {
Expand All @@ -223,6 +223,26 @@ public int compare(DropboxAPI.Entry lhs, DropboxAPI.Entry rhs) {
}
}

@Override
public void onInserted(int position, int count) {
// Ignore (DO NOT MODIFY ADAPTER HERE!)
}

@Override
public void onRemoved(int position, int count) {
// Ignore (DO NOT MODIFY ADAPTER HERE!)
}

@Override
public void onMoved(int fromPosition, int toPosition) {
// Ignore (DO NOT MODIFY ADAPTER HERE!)
}

@Override
public void onChanged(int position, int count) {
// Ignore (DO NOT MODIFY ADAPTER HERE!)
}

@Override
public boolean areContentsTheSame(DropboxAPI.Entry lhs, DropboxAPI.Entry rhs) {
return lhs.fileName().equals(rhs.fileName()) && (lhs.isDir == rhs.isDir);
Expand Down

0 comments on commit b7baea3

Please sign in to comment.