Bindings: Move to a separate package
These are really app-independent reusable classes. Moving them to a separate package helps avoid polluting the main app package, and makes them easier to upgrade. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
6945aa1107
commit
6231bb18ac
@ -13,6 +13,7 @@ import android.widget.AbsListView;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ListView;
|
||||
|
||||
import com.wireguard.android.bindings.ObservableMapAdapter;
|
||||
import com.wireguard.android.databinding.ConfigListFragmentBinding;
|
||||
import com.wireguard.config.Config;
|
||||
|
||||
|
@ -12,6 +12,8 @@ import android.preference.PreferenceManager;
|
||||
import android.service.quicksettings.TileService;
|
||||
import android.util.Log;
|
||||
|
||||
import com.wireguard.android.bindings.ObservableSortedMap;
|
||||
import com.wireguard.android.bindings.ObservableTreeMap;
|
||||
import com.wireguard.config.Config;
|
||||
import com.wireguard.config.Peer;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.wireguard.android;
|
||||
package com.wireguard.android.bindings;
|
||||
|
||||
import android.databinding.BindingAdapter;
|
||||
import android.databinding.ObservableList;
|
||||
@ -9,6 +9,8 @@ import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.wireguard.android.R;
|
||||
|
||||
/**
|
||||
* Static methods for use by generated code in the Android data binding library.
|
||||
*/
|
@ -1,4 +1,4 @@
|
||||
package com.wireguard.android;
|
||||
package com.wireguard.android.bindings;
|
||||
|
||||
import android.databinding.DataBindingUtil;
|
||||
import android.databinding.ObservableList;
|
||||
@ -7,6 +7,8 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.wireguard.android.BR;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
/**
|
@ -1,4 +1,4 @@
|
||||
package com.wireguard.android;
|
||||
package com.wireguard.android.bindings;
|
||||
|
||||
import android.content.Context;
|
||||
import android.databinding.DataBindingUtil;
|
||||
@ -10,6 +10,8 @@ import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ListAdapter;
|
||||
|
||||
import com.wireguard.android.BR;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
/**
|
@ -1,4 +1,4 @@
|
||||
package com.wireguard.android;
|
||||
package com.wireguard.android.bindings;
|
||||
|
||||
import android.content.Context;
|
||||
import android.databinding.DataBindingUtil;
|
||||
@ -10,6 +10,8 @@ import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ListAdapter;
|
||||
|
||||
import com.wireguard.android.BR;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@ -18,7 +20,8 @@ import java.util.Collections;
|
||||
* A generic ListAdapter backed by a TreeMap that adds observability.
|
||||
*/
|
||||
|
||||
class ObservableMapAdapter<K extends Comparable<K>, V> extends BaseAdapter implements ListAdapter {
|
||||
public class ObservableMapAdapter<K extends Comparable<K>, V> extends BaseAdapter
|
||||
implements ListAdapter {
|
||||
private final OnMapChangedCallback<K, V> callback = new OnMapChangedCallback<>(this);
|
||||
private ArrayList<K> keys;
|
||||
private final int layoutId;
|
@ -1,4 +1,4 @@
|
||||
package com.wireguard.android;
|
||||
package com.wireguard.android.bindings;
|
||||
|
||||
import android.databinding.ObservableMap;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.wireguard.android;
|
||||
package com.wireguard.android.bindings;
|
||||
|
||||
import android.databinding.MapChangeRegistry;
|
||||
import android.databinding.ObservableMap;
|
@ -7,7 +7,7 @@
|
||||
<!--suppress AndroidDomInspection -->
|
||||
<variable
|
||||
name="configs"
|
||||
type="com.wireguard.android.ObservableSortedMap<String, com.wireguard.config.Config>" />
|
||||
type="com.wireguard.android.bindings.ObservableSortedMap<String, com.wireguard.config.Config>" />
|
||||
</data>
|
||||
|
||||
<ListView
|
||||
|
Loading…
Reference in New Issue
Block a user