From 687841319abc56d66b807209fcbba50c64d29e4c Mon Sep 17 00:00:00 2001 From: Samuel Holland Date: Thu, 17 Aug 2017 08:22:19 -0500 Subject: MapAdapter: Stable IDs are based on value, not key This fixes list selection to survive renaming configurations. --- app/src/main/java/com/wireguard/android/ObservableMapAdapter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/src/main/java/com') 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, 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) { -- cgit v1.2.3