diff options
author | Samuel Holland <samuel@sholland.org> | 2017-08-17 08:22:19 -0500 |
---|---|---|
committer | Samuel Holland <samuel@sholland.org> | 2017-08-17 08:22:19 -0500 |
commit | 687841319abc56d66b807209fcbba50c64d29e4c (patch) | |
tree | 9b3d7376940e0011e478fb268c86d4613bea6bbc /app/src/main/java/com | |
parent | b4e3a3c4f1ec668f76d3f8b56592771d01351cb3 (diff) |
MapAdapter: Stable IDs are based on value, not key
This fixes list selection to survive renaming configurations.
Diffstat (limited to 'app/src/main/java/com')
-rw-r--r-- | app/src/main/java/com/wireguard/android/ObservableMapAdapter.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/src/main/java/com/wireguard/android/ObservableMapAdapter.java b/app/src/main/java/com/wireguard/android/ObservableMapAdapter.java index d13b2b94..1fce78c2 100644 --- a/app/src/main/java/com/wireguard/android/ObservableMapAdapter.java +++ b/app/src/main/java/com/wireguard/android/ObservableMapAdapter.java @@ -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) { |