diff options
author | Samuel Holland <samuel@sholland.org> | 2017-11-07 23:34:20 -0600 |
---|---|---|
committer | Samuel Holland <samuel@sholland.org> | 2017-11-07 23:34:22 -0600 |
commit | 6231bb18acf53342be20470d2b175fd4bb31b9ee (patch) | |
tree | 327751d0e0e4b8beda24a5c55615a7d7c5f53608 /app/src/main/java | |
parent | 6945aa11076afdbdf4e97b92b26cc13f2b5809db (diff) |
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>
Diffstat (limited to 'app/src/main/java')
-rw-r--r-- | app/src/main/java/com/wireguard/android/ConfigListFragment.java | 1 | ||||
-rw-r--r-- | app/src/main/java/com/wireguard/android/VpnService.java | 2 | ||||
-rw-r--r-- | app/src/main/java/com/wireguard/android/bindings/BindingAdapters.java (renamed from app/src/main/java/com/wireguard/android/BindingAdapters.java) | 4 | ||||
-rw-r--r-- | app/src/main/java/com/wireguard/android/bindings/ItemChangeListener.java (renamed from app/src/main/java/com/wireguard/android/ItemChangeListener.java) | 4 | ||||
-rw-r--r-- | app/src/main/java/com/wireguard/android/bindings/ObservableListAdapter.java (renamed from app/src/main/java/com/wireguard/android/ObservableListAdapter.java) | 4 | ||||
-rw-r--r-- | app/src/main/java/com/wireguard/android/bindings/ObservableMapAdapter.java (renamed from app/src/main/java/com/wireguard/android/ObservableMapAdapter.java) | 7 | ||||
-rw-r--r-- | app/src/main/java/com/wireguard/android/bindings/ObservableSortedMap.java (renamed from app/src/main/java/com/wireguard/android/ObservableSortedMap.java) | 2 | ||||
-rw-r--r-- | app/src/main/java/com/wireguard/android/bindings/ObservableTreeMap.java (renamed from app/src/main/java/com/wireguard/android/ObservableTreeMap.java) | 2 |
8 files changed, 19 insertions, 7 deletions
diff --git a/app/src/main/java/com/wireguard/android/ConfigListFragment.java b/app/src/main/java/com/wireguard/android/ConfigListFragment.java index 8586a741..c89d2339 100644 --- a/app/src/main/java/com/wireguard/android/ConfigListFragment.java +++ b/app/src/main/java/com/wireguard/android/ConfigListFragment.java @@ -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; diff --git a/app/src/main/java/com/wireguard/android/VpnService.java b/app/src/main/java/com/wireguard/android/VpnService.java index 0fd67136..265c6e57 100644 --- a/app/src/main/java/com/wireguard/android/VpnService.java +++ b/app/src/main/java/com/wireguard/android/VpnService.java @@ -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; diff --git a/app/src/main/java/com/wireguard/android/BindingAdapters.java b/app/src/main/java/com/wireguard/android/bindings/BindingAdapters.java index d5c07ed6..56540921 100644 --- a/app/src/main/java/com/wireguard/android/BindingAdapters.java +++ b/app/src/main/java/com/wireguard/android/bindings/BindingAdapters.java @@ -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. */ diff --git a/app/src/main/java/com/wireguard/android/ItemChangeListener.java b/app/src/main/java/com/wireguard/android/bindings/ItemChangeListener.java index e3f34019..39b3b654 100644 --- a/app/src/main/java/com/wireguard/android/ItemChangeListener.java +++ b/app/src/main/java/com/wireguard/android/bindings/ItemChangeListener.java @@ -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; /** diff --git a/app/src/main/java/com/wireguard/android/ObservableListAdapter.java b/app/src/main/java/com/wireguard/android/bindings/ObservableListAdapter.java index 8e240b71..5b54ecaf 100644 --- a/app/src/main/java/com/wireguard/android/ObservableListAdapter.java +++ b/app/src/main/java/com/wireguard/android/bindings/ObservableListAdapter.java @@ -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; /** diff --git a/app/src/main/java/com/wireguard/android/ObservableMapAdapter.java b/app/src/main/java/com/wireguard/android/bindings/ObservableMapAdapter.java index 308c818d..da0c36a7 100644 --- a/app/src/main/java/com/wireguard/android/ObservableMapAdapter.java +++ b/app/src/main/java/com/wireguard/android/bindings/ObservableMapAdapter.java @@ -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; diff --git a/app/src/main/java/com/wireguard/android/ObservableSortedMap.java b/app/src/main/java/com/wireguard/android/bindings/ObservableSortedMap.java index 5c96c68c..3317c6a7 100644 --- a/app/src/main/java/com/wireguard/android/ObservableSortedMap.java +++ b/app/src/main/java/com/wireguard/android/bindings/ObservableSortedMap.java @@ -1,4 +1,4 @@ -package com.wireguard.android; +package com.wireguard.android.bindings; import android.databinding.ObservableMap; diff --git a/app/src/main/java/com/wireguard/android/ObservableTreeMap.java b/app/src/main/java/com/wireguard/android/bindings/ObservableTreeMap.java index db72d857..34fcab61 100644 --- a/app/src/main/java/com/wireguard/android/ObservableTreeMap.java +++ b/app/src/main/java/com/wireguard/android/bindings/ObservableTreeMap.java @@ -1,4 +1,4 @@ -package com.wireguard.android; +package com.wireguard.android.bindings; import android.databinding.MapChangeRegistry; import android.databinding.ObservableMap; |