Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Commit

Permalink
Version Release 0.2.0
Browse files Browse the repository at this point in the history
* Updated RxAndroid dependency version to 1.0.0 in order to benefit from stripped-down package; bumped minimum SDK version to 9 because of its new requirements
* Updated example as well, using latest support library & ButterKnife now
* Changed required jmDNS permissions to automatically be included by the manifest merger, as opposed to a manual copy/paste
  • Loading branch information
mannodermaus committed Aug 7, 2015
1 parent b430245 commit 9aaa00b
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 26 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -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!

Expand All @@ -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
Expand Down Expand Up @@ -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
<uses-permission android:name="android.permission.INTERNET"/>
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
4 changes: 0 additions & 4 deletions example/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="rxbonjour.example">

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>

<application android:allowBackup="true"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
Expand Down
12 changes: 6 additions & 6 deletions example/src/main/java/rxbonjour/example/BonjourVH.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

import java.util.Iterator;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.InjectView;
import rxbonjour.example.rv.RvBaseHolder;
import rxbonjour.model.BonjourService;

Expand All @@ -16,10 +16,10 @@
*/
public class BonjourVH extends RvBaseHolder<BonjourService> {

@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
Expand All @@ -29,7 +29,7 @@ public class BonjourVH extends RvBaseHolder<BonjourService> {
*/
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) {
Expand Down
13 changes: 9 additions & 4 deletions example/src/main/java/rxbonjour/example/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<BonjourService> adapter;

private Subscription nsdSubscription;
Expand All @@ -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));
Expand All @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions example/src/main/java/rxbonjour/example/rv/RvBaseHolder.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -15,6 +16,7 @@
*
* @param <E> Item type to be held by the view holder
*/
@TargetApi(ICE_CREAM_SANDWICH)
public abstract class RvBaseHolder<E> extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener {

/** The item held by the view holder */
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
9 changes: 8 additions & 1 deletion lib/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
<manifest package="rxbonjour">
<manifest
package="rxbonjour"
xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>

</manifest>

0 comments on commit 9aaa00b

Please sign in to comment.