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 | 5b4e957122e60f7d1121309ef573ddb57ce7b6d8 (patch) | |
tree | 9b3d7376940e0011e478fb268c86d4613bea6bbc /app/src/main/java | |
parent | 85fc5e7ebfbde91aaaff94e7ba89ca15c3c2a81c (diff) |
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>
Diffstat (limited to 'app/src/main/java')
-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) { |