MapAdapter: Stable IDs are based on value, not key
This fixes list selection to survive renaming configurations. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
85fc5e7ebf
commit
5b4e957122
@ -48,7 +48,7 @@ class ObservableMapAdapter<K extends Comparable<K>, V> extends BaseAdapter imple
|
|||||||
public long getItemId(final int position) {
|
public long getItemId(final int position) {
|
||||||
if (map == null || position < 0 || position >= map.size())
|
if (map == null || position < 0 || position >= map.size())
|
||||||
return -1;
|
return -1;
|
||||||
return getKeys().get(position).hashCode();
|
return map.get(getKeys().get(position)).hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getItemPosition(final K key) {
|
public int getItemPosition(final K key) {
|
||||||
|
Loading…
Reference in New Issue
Block a user