util: Extract non-Android utility interfaces

As part of a refactoring that will likely introduce more custom
collection classes, move the non-Android-specific parts outside the
com.wireguard.android package.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Samuel Holland 2018-06-19 00:47:48 -05:00
parent d3a8291a7a
commit 4acee49d4b
10 changed files with 17 additions and 9 deletions

View File

@ -15,7 +15,7 @@ import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
import com.wireguard.android.R; 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.util.ObservableKeyedList;
import com.wireguard.android.widget.ToggleSwitch; import com.wireguard.android.widget.ToggleSwitch;
import com.wireguard.android.widget.ToggleSwitch.OnBeforeCheckedChangeListener; import com.wireguard.android.widget.ToggleSwitch.OnBeforeCheckedChangeListener;

View File

@ -16,7 +16,7 @@ import android.view.ViewGroup;
import android.widget.BaseAdapter; import android.widget.BaseAdapter;
import com.wireguard.android.BR; import com.wireguard.android.BR;
import com.wireguard.android.util.Keyed; import com.wireguard.util.Keyed;
import com.wireguard.android.util.ObservableKeyedList; import com.wireguard.android.util.ObservableKeyedList;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;

View File

@ -13,7 +13,7 @@ import android.support.annotation.Nullable;
import com.wireguard.android.BR; import com.wireguard.android.BR;
import com.wireguard.android.util.ExceptionLoggers; import com.wireguard.android.util.ExceptionLoggers;
import com.wireguard.android.util.Keyed; import com.wireguard.util.Keyed;
import com.wireguard.config.Config; import com.wireguard.config.Config;
import java.util.regex.Pattern; import java.util.regex.Pattern;

View File

@ -9,6 +9,8 @@ package com.wireguard.android.util;
import android.databinding.ObservableArrayList; import android.databinding.ObservableArrayList;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import com.wireguard.util.Keyed;
import java.util.Collection; import java.util.Collection;
import java.util.ListIterator; import java.util.ListIterator;
import java.util.Objects; import java.util.Objects;

View File

@ -8,6 +8,9 @@ package com.wireguard.android.util;
import android.databinding.ObservableList; import android.databinding.ObservableList;
import com.wireguard.util.Keyed;
import com.wireguard.util.KeyedList;
/** /**
* A list that is both keyed and observable. * A list that is both keyed and observable.
*/ */

View File

@ -8,6 +8,9 @@ package com.wireguard.android.util;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import com.wireguard.util.Keyed;
import com.wireguard.util.SortedKeyedList;
import java.util.AbstractList; import java.util.AbstractList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;

View File

@ -6,6 +6,9 @@
package com.wireguard.android.util; package com.wireguard.android.util;
import com.wireguard.util.Keyed;
import com.wireguard.util.SortedKeyedList;
/** /**
* A list that is both sorted/keyed and observable. * A list that is both sorted/keyed and observable.
*/ */

View File

@ -1,10 +1,9 @@
/* /*
* Copyright © 2018 Samuel Holland <samuel@sholland.org> * 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 * SPDX-License-Identifier: GPL-2.0-or-later
*/ */
package com.wireguard.android.util; package com.wireguard.util;
/** /**
* Interface for objects that have a identifying key of the given type. * Interface for objects that have a identifying key of the given type.

View File

@ -1,10 +1,9 @@
/* /*
* Copyright © 2018 Samuel Holland <samuel@sholland.org> * 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 * SPDX-License-Identifier: GPL-2.0-or-later
*/ */
package com.wireguard.android.util; package com.wireguard.util;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;

View File

@ -1,10 +1,9 @@
/* /*
* Copyright © 2018 Samuel Holland <samuel@sholland.org> * 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 * SPDX-License-Identifier: GPL-2.0-or-later
*/ */
package com.wireguard.android.util; package com.wireguard.util;
import java.util.Collection; import java.util.Collection;
import java.util.Comparator; import java.util.Comparator;