summaryrefslogtreecommitdiffhomepage
path: root/app/src/main/java
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2017-08-18 23:25:40 -0500
committerSamuel Holland <samuel@sholland.org>2017-08-18 23:25:40 -0500
commita49fe9adf54cf9f3463e061e8dac8134e31584c8 (patch)
treed975d1eae97110b4cdf4d5b4559fee26bb2dc506 /app/src/main/java
parent5b4e957122e60f7d1121309ef573ddb57ce7b6d8 (diff)
ObservableAdapters: notify on map/list being set
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/ObservableListAdapter.java3
-rw-r--r--app/src/main/java/com/wireguard/android/ObservableMapAdapter.java1
-rw-r--r--app/src/main/java/com/wireguard/android/ObservableTreeMap.java1
3 files changed, 2 insertions, 3 deletions
diff --git a/app/src/main/java/com/wireguard/android/ObservableListAdapter.java b/app/src/main/java/com/wireguard/android/ObservableListAdapter.java
index 66cb957d..c69af4b5 100644
--- a/app/src/main/java/com/wireguard/android/ObservableListAdapter.java
+++ b/app/src/main/java/com/wireguard/android/ObservableListAdapter.java
@@ -23,7 +23,6 @@ class ObservableListAdapter<T> extends BaseAdapter implements ListAdapter {
private final OnListChangedCallback<T> callback = new OnListChangedCallback<>(this);
ObservableListAdapter(final Context context, final int layoutId, final ObservableList<T> list) {
- super();
layoutInflater = LayoutInflater.from(context);
this.layoutId = layoutId;
setList(list);
@@ -61,6 +60,7 @@ class ObservableListAdapter<T> extends BaseAdapter implements ListAdapter {
if (list != null) {
list.addOnListChangedCallback(callback);
}
+ notifyDataSetChanged();
}
private static class OnListChangedCallback<U>
@@ -69,7 +69,6 @@ class ObservableListAdapter<T> extends BaseAdapter implements ListAdapter {
private final WeakReference<ObservableListAdapter<U>> weakAdapter;
private OnListChangedCallback(final ObservableListAdapter<U> adapter) {
- super();
weakAdapter = new WeakReference<>(adapter);
}
diff --git a/app/src/main/java/com/wireguard/android/ObservableMapAdapter.java b/app/src/main/java/com/wireguard/android/ObservableMapAdapter.java
index 1fce78c2..3090ed5e 100644
--- a/app/src/main/java/com/wireguard/android/ObservableMapAdapter.java
+++ b/app/src/main/java/com/wireguard/android/ObservableMapAdapter.java
@@ -86,6 +86,7 @@ class ObservableMapAdapter<K extends Comparable<K>, V> extends BaseAdapter imple
if (map != null) {
map.addOnMapChangedCallback(callback);
}
+ notifyDataSetChanged();
}
private static class OnMapChangedCallback<K extends Comparable<K>, V>
diff --git a/app/src/main/java/com/wireguard/android/ObservableTreeMap.java b/app/src/main/java/com/wireguard/android/ObservableTreeMap.java
index b0444d66..db72d857 100644
--- a/app/src/main/java/com/wireguard/android/ObservableTreeMap.java
+++ b/app/src/main/java/com/wireguard/android/ObservableTreeMap.java
@@ -4,7 +4,6 @@ import android.databinding.MapChangeRegistry;
import android.databinding.ObservableMap;
import android.support.annotation.NonNull;
-import java.util.Iterator;
import java.util.Map;
import java.util.TreeMap;