mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-26 02:43:39 +02:00
Updated selection tracker to version 1.1.0-alpha01
This commit is contained in:
@@ -21,12 +21,10 @@ import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.collection.LongSparseArray;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.RecyclerView.OnChildAttachStateChangeListener;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* An {@link ItemKeyProvider} that provides stable ids by way of cached
|
||||
* {@link RecyclerView.Adapter} stable ids. Items enter the cache as they are laid out by
|
||||
@@ -40,7 +38,7 @@ import java.util.Map;
|
||||
public final class StableIdKeyProvider extends ItemKeyProvider<Long> {
|
||||
|
||||
private final SparseArray<Long> mPositionToKey = new SparseArray<>();
|
||||
private final Map<Long, Integer> mKeyToPosition = new HashMap<Long, Integer>();
|
||||
private final LongSparseArray<Integer> mKeyToPosition = new LongSparseArray<>();
|
||||
private final RecyclerView mRecyclerView;
|
||||
|
||||
/**
|
||||
@@ -102,9 +100,6 @@ public final class StableIdKeyProvider extends ItemKeyProvider<Long> {
|
||||
|
||||
@Override
|
||||
public int getPosition(@NonNull Long key) {
|
||||
if (mKeyToPosition.containsKey(key)) {
|
||||
return mKeyToPosition.get(key);
|
||||
}
|
||||
return RecyclerView.NO_POSITION;
|
||||
return mKeyToPosition.get(key, RecyclerView.NO_POSITION);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user