diff options
Diffstat (limited to 'app/src/main/java/com/wireguard/android')
10 files changed, 14 insertions, 75 deletions
diff --git a/app/src/main/java/com/wireguard/android/databinding/BindingAdapters.java b/app/src/main/java/com/wireguard/android/databinding/BindingAdapters.java index bd8d6efd..ba6845ba 100644 --- a/app/src/main/java/com/wireguard/android/databinding/BindingAdapters.java +++ b/app/src/main/java/com/wireguard/android/databinding/BindingAdapters.java @@ -15,7 +15,7 @@ import android.widget.ListView; import android.widget.TextView; import com.wireguard.android.R; -import com.wireguard.android.util.Keyed; +import com.wireguard.util.Keyed; import com.wireguard.android.util.ObservableKeyedList; import com.wireguard.android.widget.ToggleSwitch; import com.wireguard.android.widget.ToggleSwitch.OnBeforeCheckedChangeListener; diff --git a/app/src/main/java/com/wireguard/android/databinding/ObservableKeyedListAdapter.java b/app/src/main/java/com/wireguard/android/databinding/ObservableKeyedListAdapter.java index 90c85582..452d2ec4 100644 --- a/app/src/main/java/com/wireguard/android/databinding/ObservableKeyedListAdapter.java +++ b/app/src/main/java/com/wireguard/android/databinding/ObservableKeyedListAdapter.java @@ -16,7 +16,7 @@ import android.view.ViewGroup; import android.widget.BaseAdapter; import com.wireguard.android.BR; -import com.wireguard.android.util.Keyed; +import com.wireguard.util.Keyed; import com.wireguard.android.util.ObservableKeyedList; import java.lang.ref.WeakReference; diff --git a/app/src/main/java/com/wireguard/android/model/Tunnel.java b/app/src/main/java/com/wireguard/android/model/Tunnel.java index bdfa0dbc..0b1ba895 100644 --- a/app/src/main/java/com/wireguard/android/model/Tunnel.java +++ b/app/src/main/java/com/wireguard/android/model/Tunnel.java @@ -13,7 +13,7 @@ import android.support.annotation.Nullable; import com.wireguard.android.BR; import com.wireguard.android.util.ExceptionLoggers; -import com.wireguard.android.util.Keyed; +import com.wireguard.util.Keyed; import com.wireguard.config.Config; import java.util.regex.Pattern; diff --git a/app/src/main/java/com/wireguard/android/util/Keyed.java b/app/src/main/java/com/wireguard/android/util/Keyed.java deleted file mode 100644 index ca8c142a..00000000 --- a/app/src/main/java/com/wireguard/android/util/Keyed.java +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright © 2018 Samuel Holland <samuel@sholland.org> - * Copyright © 2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved. - * SPDX-License-Identifier: GPL-2.0-or-later - */ - -package com.wireguard.android.util; - -/** - * Interface for objects that have a identifying key of the given type. - */ - -public interface Keyed<K> { - K getKey(); -} diff --git a/app/src/main/java/com/wireguard/android/util/KeyedList.java b/app/src/main/java/com/wireguard/android/util/KeyedList.java deleted file mode 100644 index 9518758e..00000000 --- a/app/src/main/java/com/wireguard/android/util/KeyedList.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright © 2018 Samuel Holland <samuel@sholland.org> - * Copyright © 2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved. - * SPDX-License-Identifier: GPL-2.0-or-later - */ - -package com.wireguard.android.util; - -import java.util.Collection; -import java.util.List; - -/** - * A list containing elements that can be looked up by key. A {@code KeyedList} cannot contain - * {@code null} elements. - */ - -public interface KeyedList<K, E extends Keyed<? extends K>> extends List<E> { - boolean containsAllKeys(Collection<K> keys); - - boolean containsKey(K key); - - E get(K key); - - E getLast(K key); - - int indexOfKey(K key); - - int lastIndexOfKey(K key); -} diff --git a/app/src/main/java/com/wireguard/android/util/ObservableKeyedArrayList.java b/app/src/main/java/com/wireguard/android/util/ObservableKeyedArrayList.java index 70842052..10558319 100644 --- a/app/src/main/java/com/wireguard/android/util/ObservableKeyedArrayList.java +++ b/app/src/main/java/com/wireguard/android/util/ObservableKeyedArrayList.java @@ -9,6 +9,8 @@ package com.wireguard.android.util; import android.databinding.ObservableArrayList; import android.support.annotation.NonNull; +import com.wireguard.util.Keyed; + import java.util.Collection; import java.util.ListIterator; import java.util.Objects; diff --git a/app/src/main/java/com/wireguard/android/util/ObservableKeyedList.java b/app/src/main/java/com/wireguard/android/util/ObservableKeyedList.java index d810b703..169afe42 100644 --- a/app/src/main/java/com/wireguard/android/util/ObservableKeyedList.java +++ b/app/src/main/java/com/wireguard/android/util/ObservableKeyedList.java @@ -8,6 +8,9 @@ package com.wireguard.android.util; import android.databinding.ObservableList; +import com.wireguard.util.Keyed; +import com.wireguard.util.KeyedList; + /** * A list that is both keyed and observable. */ diff --git a/app/src/main/java/com/wireguard/android/util/ObservableSortedKeyedArrayList.java b/app/src/main/java/com/wireguard/android/util/ObservableSortedKeyedArrayList.java index 0612deb5..58ec4383 100644 --- a/app/src/main/java/com/wireguard/android/util/ObservableSortedKeyedArrayList.java +++ b/app/src/main/java/com/wireguard/android/util/ObservableSortedKeyedArrayList.java @@ -8,6 +8,9 @@ package com.wireguard.android.util; import android.support.annotation.NonNull; +import com.wireguard.util.Keyed; +import com.wireguard.util.SortedKeyedList; + import java.util.AbstractList; import java.util.Collection; import java.util.Collections; diff --git a/app/src/main/java/com/wireguard/android/util/ObservableSortedKeyedList.java b/app/src/main/java/com/wireguard/android/util/ObservableSortedKeyedList.java index 5a821689..8ebc5985 100644 --- a/app/src/main/java/com/wireguard/android/util/ObservableSortedKeyedList.java +++ b/app/src/main/java/com/wireguard/android/util/ObservableSortedKeyedList.java @@ -6,6 +6,9 @@ package com.wireguard.android.util; +import com.wireguard.util.Keyed; +import com.wireguard.util.SortedKeyedList; + /** * A list that is both sorted/keyed and observable. */ diff --git a/app/src/main/java/com/wireguard/android/util/SortedKeyedList.java b/app/src/main/java/com/wireguard/android/util/SortedKeyedList.java deleted file mode 100644 index cca6d017..00000000 --- a/app/src/main/java/com/wireguard/android/util/SortedKeyedList.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright © 2018 Samuel Holland <samuel@sholland.org> - * Copyright © 2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved. - * SPDX-License-Identifier: GPL-2.0-or-later - */ - -package com.wireguard.android.util; - -import java.util.Collection; -import java.util.Comparator; -import java.util.Set; - -/** - * A keyed list where all elements are sorted by the comparator returned by {@code comparator()} - * applied to their keys. - */ - -public interface SortedKeyedList<K, E extends Keyed<? extends K>> extends KeyedList<K, E> { - Comparator<? super K> comparator(); - - K firstKey(); - - Set<K> keySet(); - - K lastKey(); - - Collection<E> values(); -} |