Keyed...: Rename all the things

Hooray for diamond interface inheritance.

Signed-off-by: Samuel Holland <samuel@sholland.org>
This commit is contained in:
Samuel Holland
2018-01-06 23:07:17 -06:00
parent 4d38993832
commit 4f2b6bef84
9 changed files with 32 additions and 33 deletions
@@ -11,7 +11,7 @@ import android.widget.TextView;
import com.wireguard.android.R;
import com.wireguard.android.util.Keyed;
import com.wireguard.android.util.KeyedObservableList;
import com.wireguard.android.util.ObservableKeyedList;
import com.wireguard.android.widget.ToggleSwitch;
import com.wireguard.android.widget.ToggleSwitch.OnBeforeCheckedChangeListener;
@@ -68,13 +68,13 @@ public final class BindingAdapters {
@BindingAdapter({"items", "layout"})
public static <K, E extends Keyed<? extends K>>
void setItems(final ListView view,
final KeyedObservableList<K, E> oldList, final int oldLayoutId,
final KeyedObservableList<K, E> newList, final int newLayoutId) {
final ObservableKeyedList<K, E> oldList, final int oldLayoutId,
final ObservableKeyedList<K, E> newList, final int newLayoutId) {
if (oldList == newList && oldLayoutId == newLayoutId)
return;
// The ListAdapter interface is not generic, so this cannot be checked.
@SuppressWarnings("unchecked") KeyedObservableListAdapter<K, E> adapter =
(KeyedObservableListAdapter<K, E>) view.getAdapter();
@SuppressWarnings("unchecked") ObservableKeyedListAdapter<K, E> adapter =
(ObservableKeyedListAdapter<K, E>) view.getAdapter();
// If the layout changes, any existing adapter must be replaced.
if (adapter != null && oldList != null && oldLayoutId != newLayoutId) {
adapter.setList(null);
@@ -84,7 +84,7 @@ public final class BindingAdapters {
if (newList == null || newLayoutId == 0)
return;
if (adapter == null) {
adapter = new KeyedObservableListAdapter<>(view.getContext(), newLayoutId, newList);
adapter = new ObservableKeyedListAdapter<>(view.getContext(), newLayoutId, newList);
view.setAdapter(adapter);
}
// Either the list changed, or this is an entirely new listener because the layout changed.