summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2017-08-17 08:22:19 -0500
committerSamuel Holland <samuel@sholland.org>2017-08-17 08:22:19 -0500
commit5b4e957122e60f7d1121309ef573ddb57ce7b6d8 (patch)
tree9b3d7376940e0011e478fb268c86d4613bea6bbc
parent85fc5e7ebfbde91aaaff94e7ba89ca15c3c2a81c (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>
-rw-r--r--app/src/main/java/com/wireguard/android/ObservableMapAdapter.java2
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) {