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:
Samuel Holland 2017-08-17 08:22:19 -05:00
parent 85fc5e7ebf
commit 5b4e957122

View File

@ -48,7 +48,7 @@ class ObservableMapAdapter<K extends Comparable<K>, V> extends BaseAdapter imple
public long getItemId(final int position) {
if (map == null || position < 0 || position >= map.size())
return -1;
return getKeys().get(position).hashCode();
return map.get(getKeys().get(position)).hashCode();
}
public int getItemPosition(final K key) {