diff --git a/README.md b/README.md index 69269bc..28ab706 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # RxBonjour -Say "Hi!" to RxBonjour, a wrapper around Android's network service discovery functionalities with a support implementation for devices below Jelly Bean, going down all the way to API level 8. +Say "Hi!" to RxBonjour, a wrapper around Android's network service discovery functionalities with a support implementation for devices below Jelly Bean, going down all the way to API level 9. Disclaimer: This library is to be considered **very early** in terms of maturity. There will probably be issues, especially since NSD is a fragile topic on Android! @@ -16,7 +16,7 @@ repositories { Now, you can add the RxBonjour dependency: ```groovy -compile 'com.github.aurae:RxBonjour:0.1.5' +compile 'com.github.aurae:RxBonjour:0.2.0' ``` ## Usage @@ -65,9 +65,9 @@ RxBonjour.startDiscovery(this, "_http._tcp", true) On devices running Jelly Bean and up, Android's native Network Service Discovery API, centered around `NsdManager`, can be used. -### Support implementation (v8) +### Support implementation (v9) -The support implementation utilizes the latest available version of [jmDNS][jmdns] (a snapshot of version **3.4.2**) and a `WifiManager` multicast lock as its service discovery backbone; because of this, you need to add the following permissions to your `AndroidManifest.xml` in order to allow jmDNS to do its thing: +The support implementation utilizes the latest available version of [jmDNS][jmdns] (a snapshot of version **3.4.2**) and a `WifiManager` multicast lock as its service discovery backbone; because of this, including this library in your application's dependencies automatically adds the following permissions to your `AndroidManifest.xml`, in order to allow jmDNS to do its thing: ```xml diff --git a/build.gradle b/build.gradle index bf5871d..30e6741 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.2.3' + classpath 'com.android.tools.build:gradle:1.3.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/example/build.gradle b/example/build.gradle index bc16ef1..4f51e7c 100644 --- a/example/build.gradle +++ b/example/build.gradle @@ -21,7 +21,7 @@ android { dependencies { compile project(':lib') - compile 'com.jakewharton:butterknife:6.1.0' - compile 'com.android.support:appcompat-v7:22.1.1' - compile 'com.android.support:recyclerview-v7:22.1.1' + compile 'com.jakewharton:butterknife:7.0.1' + compile 'com.android.support:appcompat-v7:22.2.1' + compile 'com.android.support:recyclerview-v7:22.2.1' } diff --git a/example/src/main/AndroidManifest.xml b/example/src/main/AndroidManifest.xml index 8065fad..4461122 100644 --- a/example/src/main/AndroidManifest.xml +++ b/example/src/main/AndroidManifest.xml @@ -1,10 +1,6 @@ - - - - { - @InjectView(R.id.tv_name) TextView tvName; - @InjectView(R.id.tv_type) TextView tvType; - @InjectView(R.id.tv_host_port) TextView tvHostPort; - @InjectView(R.id.tv_txtrecords) TextView tvTxtRecords; + @Bind(R.id.tv_name) TextView tvName; + @Bind(R.id.tv_type) TextView tvType; + @Bind(R.id.tv_host_port) TextView tvHostPort; + @Bind(R.id.tv_txtrecords) TextView tvTxtRecords; /** * Constructor @@ -29,7 +29,7 @@ public class BonjourVH extends RvBaseHolder { */ protected BonjourVH(LayoutInflater inflater, ViewGroup parent) { super(inflater, parent, R.layout.item_bonjourservice); - ButterKnife.inject(this, itemView); + ButterKnife.bind(this, itemView); } @Override protected void onBindItem(BonjourService item) { diff --git a/example/src/main/java/rxbonjour/example/MainActivity.java b/example/src/main/java/rxbonjour/example/MainActivity.java index 9390848..ad4ea3c 100644 --- a/example/src/main/java/rxbonjour/example/MainActivity.java +++ b/example/src/main/java/rxbonjour/example/MainActivity.java @@ -10,8 +10,8 @@ import android.widget.EditText; import android.widget.Toast; +import butterknife.Bind; import butterknife.ButterKnife; -import butterknife.InjectView; import butterknife.OnClick; import butterknife.OnItemSelected; import rx.Subscription; @@ -27,8 +27,8 @@ */ public class MainActivity extends AppCompatActivity { - @InjectView(R.id.rv) rxbonjour.example.rv.Rv rvItems; - @InjectView(R.id.et_type) EditText etInput; + @Bind(R.id.rv) rxbonjour.example.rv.Rv rvItems; + @Bind(R.id.et_type) EditText etInput; private RvBaseAdapter adapter; private Subscription nsdSubscription; @@ -37,7 +37,7 @@ public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); - ButterKnife.inject(this); + ButterKnife.bind(this); // Setup RecyclerView rvItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); @@ -64,6 +64,11 @@ public class MainActivity extends AppCompatActivity { unsubscribe(); } + @Override protected void onDestroy() { + super.onDestroy(); + ButterKnife.unbind(this); + } + @OnClick(R.id.button_apply) void onApplyClicked() { CharSequence input = etInput.getText(); if (input != null && input.length() > 0) { diff --git a/example/src/main/java/rxbonjour/example/rv/RvBaseHolder.java b/example/src/main/java/rxbonjour/example/rv/RvBaseHolder.java index 4b560d1..f889c32 100644 --- a/example/src/main/java/rxbonjour/example/rv/RvBaseHolder.java +++ b/example/src/main/java/rxbonjour/example/rv/RvBaseHolder.java @@ -1,5 +1,6 @@ package rxbonjour.example.rv; +import android.annotation.TargetApi; import android.os.Build; import android.support.annotation.LayoutRes; import android.support.v7.widget.RecyclerView; @@ -15,6 +16,7 @@ * * @param Item type to be held by the view holder */ +@TargetApi(ICE_CREAM_SANDWICH) public abstract class RvBaseHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener { /** The item held by the view holder */ diff --git a/gradle.properties b/gradle.properties index 8e5283a..d3b192b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,10 +7,10 @@ COMPILE_SDK_VERSION=android-22 BUILD_TOOLS_VERSION=22.0.1 # Minimum SDK version (lowest SDK platform to target) -MIN_SDK_VERSION=8 +MIN_SDK_VERSION=9 # Target SDK version (highest SDK platform to target) TARGET_SDK_VERSION=22 # Current library version -VERSION_NAME=0.1.5 +VERSION_NAME=0.2.0 diff --git a/lib/build.gradle b/lib/build.gradle index 5da46be..241d78e 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -14,7 +14,7 @@ android { dependencies { // Reactive extensions - compile 'io.reactivex:rxandroid:0.24.0' + compile 'io.reactivex:rxandroid:1.0.0' // Network Service Discovery (pre-JB) compile 'com.github.openhab:jmdns:24c28e141a' diff --git a/lib/src/main/AndroidManifest.xml b/lib/src/main/AndroidManifest.xml index daa58fd..a9dad6b 100644 --- a/lib/src/main/AndroidManifest.xml +++ b/lib/src/main/AndroidManifest.xml @@ -1,2 +1,9 @@ - + + + + + +