diff options
Diffstat (limited to 'app/src/main/java/com/wireguard/android/BindingAdapters.java')
-rw-r--r-- | app/src/main/java/com/wireguard/android/BindingAdapters.java | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/app/src/main/java/com/wireguard/android/BindingAdapters.java b/app/src/main/java/com/wireguard/android/BindingAdapters.java index 7e93c228..e3df7bb4 100644 --- a/app/src/main/java/com/wireguard/android/BindingAdapters.java +++ b/app/src/main/java/com/wireguard/android/BindingAdapters.java @@ -15,34 +15,6 @@ import android.widget.TextView; @SuppressWarnings("unused") public final class BindingAdapters { @BindingAdapter({"items", "layout"}) - public static <K, V> void arrayMapBinding(final ListView view, - final ObservableArrayMap<K, V> oldMap, - final int oldLayoutId, - final ObservableArrayMap<K, V> newMap, - final int newLayoutId) { - // Remove any existing binding when there is no new map. - if (newMap == null) { - view.setAdapter(null); - return; - } - // The ListAdapter interface is not generic, so this cannot be checked. - @SuppressWarnings("unchecked") - ObservableArrayMapAdapter<K, V> adapter = - (ObservableArrayMapAdapter<K, V>) view.getAdapter(); - // If the layout changes, any existing adapter must be replaced. - if (newLayoutId != oldLayoutId) - adapter = null; - // Add a new binding if there was none, or if it must be replaced due to a layout change. - if (adapter == null) { - adapter = new ObservableArrayMapAdapter<>(view.getContext(), newLayoutId, newMap); - view.setAdapter(adapter); - } else if (newMap != oldMap) { - // Changing the list only requires modifying the existing adapter. - adapter.setMap(newMap); - } - } - - @BindingAdapter({"items", "layout"}) public static <T> void listBinding(final ListView view, final ObservableList<T> oldList, final int oldLayoutId, final ObservableList<T> newList, final int newLayoutId) { |