diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser
index 6a80f45..b09aa6d 100644
Binary files a/.idea/caches/build_file_checksums.ser and b/.idea/caches/build_file_checksums.ser differ
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
index 30aa626..ae78c11 100644
--- a/.idea/codeStyles/Project.xml
+++ b/.idea/codeStyles/Project.xml
@@ -1,29 +1,113 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ xmlns:android
+
+ ^$
+
+
+
+
+
+
+
+
+ xmlns:.*
+
+ ^$
+
+
+ BY_NAME
+
+
+
+
+
+
+ .*:id
+
+ http://schemas.android.com/apk/res/android
+
+
+
+
+
+
+
+
+ .*:name
+
+ http://schemas.android.com/apk/res/android
+
+
+
+
+
+
+
+
+ name
+
+ ^$
+
+
+
+
+
+
+
+
+ style
+
+ ^$
+
+
+
+
+
+
+
+
+ .*
+
+ ^$
+
+
+ BY_NAME
+
+
+
+
+
+
+ .*
+
+ http://schemas.android.com/apk/res/android
+
+
+ ANDROID_ATTRIBUTE_ORDER
+
+
+
+
+
+
+ .*
+
+ .*
+
+
+ BY_NAME
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 81aa47d..ccd5f2e 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -3,6 +3,9 @@
diff --git a/.idea/misc.xml b/.idea/misc.xml
index cc51e58..a31aec7 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -5,27 +5,41 @@
-
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
-
+
diff --git a/build.gradle b/build.gradle
index c58fe64..ab78dfc 100644
--- a/build.gradle
+++ b/build.gradle
@@ -7,7 +7,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.1.3'
+ classpath 'com.android.tools.build:gradle:3.5.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
diff --git a/gradle.properties b/gradle.properties
index 743d692..8de5058 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -6,6 +6,8 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
+android.enableJetifier=true
+android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index abd85de..bb81485 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Mon Aug 06 16:53:02 CST 2018
+#Tue Dec 03 17:44:04 CST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
diff --git a/rxblelib/build.gradle b/rxblelib/build.gradle
index 876d801..8493baa 100644
--- a/rxblelib/build.gradle
+++ b/rxblelib/build.gradle
@@ -3,13 +3,13 @@ apply plugin: 'com.github.dcendents.android-maven'
android {
- compileSdkVersion 27
+ compileSdkVersion 28
defaultConfig {
minSdkVersion 18
- targetSdkVersion 27
+ targetSdkVersion 28
versionCode 1
versionName "1.0"
}
@@ -26,6 +26,6 @@ group = 'com.github.JoeSteven' // 最好是你的 github 名字
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
- api 'com.polidea.rxandroidble2:rxandroidble:1.6.0'
+ api 'com.polidea.rxandroidble2:rxandroidble:1.10.5'
api 'io.reactivex.rxjava2:rxandroid:2.0.2'
}
diff --git a/rxblelib/src/main/AndroidManifest.xml b/rxblelib/src/main/AndroidManifest.xml
index 1d64d6f..62d05f2 100644
--- a/rxblelib/src/main/AndroidManifest.xml
+++ b/rxblelib/src/main/AndroidManifest.xml
@@ -1,6 +1,6 @@
-
+
diff --git a/rxblelib/src/main/java/com/joey/rxble/RxBle.java b/rxblelib/src/main/java/com/joey/rxble/RxBle.java
index a1a9e34..635101b 100644
--- a/rxblelib/src/main/java/com/joey/rxble/RxBle.java
+++ b/rxblelib/src/main/java/com/joey/rxble/RxBle.java
@@ -3,18 +3,15 @@
import android.Manifest;
import android.annotation.SuppressLint;
-import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothGattCharacteristic;
import android.content.Context;
-import android.support.annotation.MainThread;
-import android.util.Log;
+import androidx.annotation.MainThread;
import com.polidea.rxandroidble2.RxBleClient;
import com.polidea.rxandroidble2.internal.RxBleLog;
import io.reactivex.android.schedulers.AndroidSchedulers;
-import io.reactivex.plugins.RxJavaPlugins;
import io.reactivex.subjects.PublishSubject;
diff --git a/rxblelib/src/main/java/com/joey/rxble/RxBleOperator.java b/rxblelib/src/main/java/com/joey/rxble/RxBleOperator.java
index 1bd48e7..df4908b 100644
--- a/rxblelib/src/main/java/com/joey/rxble/RxBleOperator.java
+++ b/rxblelib/src/main/java/com/joey/rxble/RxBleOperator.java
@@ -3,7 +3,8 @@
import android.annotation.SuppressLint;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothGattDescriptor;
-import android.support.annotation.NonNull;
+
+import androidx.annotation.NonNull;
import com.joey.rxble.exception.BleEnableException;
import com.polidea.rxandroidble2.NotificationSetupMode;
diff --git a/rxblelib/src/main/java/com/joey/rxble/operation/RxBleNotifyCharacteristicFunc.java b/rxblelib/src/main/java/com/joey/rxble/operation/RxBleNotifyCharacteristicFunc.java
index fa4cf63..e86d3c2 100644
--- a/rxblelib/src/main/java/com/joey/rxble/operation/RxBleNotifyCharacteristicFunc.java
+++ b/rxblelib/src/main/java/com/joey/rxble/operation/RxBleNotifyCharacteristicFunc.java
@@ -9,7 +9,6 @@
import java.util.UUID;
import io.reactivex.Observable;
-import io.reactivex.ObservableSource;
import io.reactivex.functions.Function;
/**
diff --git a/rxblelib/src/main/java/com/joey/rxble/operation/RxBleReadCharacteristicFunc.java b/rxblelib/src/main/java/com/joey/rxble/operation/RxBleReadCharacteristicFunc.java
index 8dec042..2077e49 100644
--- a/rxblelib/src/main/java/com/joey/rxble/operation/RxBleReadCharacteristicFunc.java
+++ b/rxblelib/src/main/java/com/joey/rxble/operation/RxBleReadCharacteristicFunc.java
@@ -8,7 +8,6 @@
import java.util.UUID;
import io.reactivex.ObservableSource;
-import io.reactivex.SingleSource;
import io.reactivex.functions.Function;
/**
diff --git a/sample/build.gradle b/sample/build.gradle
index 8bf860f..faa4bd4 100644
--- a/sample/build.gradle
+++ b/sample/build.gradle
@@ -1,14 +1,14 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 27
+ compileSdkVersion 28
defaultConfig {
- applicationId "com.joey.rxble"
+ applicationId "com.joey.sample"
minSdkVersion 18
- targetSdkVersion 27
+ targetSdkVersion 28
versionCode 1
versionName "1.0"
- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
@@ -24,7 +24,7 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
- implementation 'com.android.support:appcompat-v7:27.1.1'
implementation project(':rxblelib')
- implementation 'com.android.support:recyclerview-v7:27.1.1'
+ implementation 'androidx.appcompat:appcompat:1.1.0'
+ implementation 'androidx.recyclerview:recyclerview:1.1.0'
}
diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml
index a237185..c04e2aa 100644
--- a/sample/src/main/AndroidManifest.xml
+++ b/sample/src/main/AndroidManifest.xml
@@ -1,6 +1,6 @@
+ package="com.joey.sample">
@@ -10,21 +10,22 @@
-
+
-
+
+
\ No newline at end of file
diff --git a/sample/src/main/java/com/joey/rxble/sample/BleApplication.java b/sample/src/main/java/com/joey/sample/BleApplication.java
similarity index 92%
rename from sample/src/main/java/com/joey/rxble/sample/BleApplication.java
rename to sample/src/main/java/com/joey/sample/BleApplication.java
index 5857008..3262eec 100644
--- a/sample/src/main/java/com/joey/rxble/sample/BleApplication.java
+++ b/sample/src/main/java/com/joey/sample/BleApplication.java
@@ -1,15 +1,15 @@
-package com.joey.rxble.sample;
+package com.joey.sample;
import android.app.Activity;
import android.app.Application;
import android.os.Bundle;
-import android.support.annotation.NonNull;
+import androidx.annotation.NonNull;
import android.util.Log;
import com.joey.rxble.BuildConfig;
import com.joey.rxble.RxBle;
-import com.joey.rxble.sample.permission.PermissionListener;
-import com.joey.rxble.sample.permission.PermissionUtil;
+import com.joey.sample.permission.PermissionListener;
+import com.joey.sample.permission.PermissionUtil;
/**
diff --git a/sample/src/main/java/com/joey/rxble/sample/ScanActivity.java b/sample/src/main/java/com/joey/sample/ScanActivity.java
similarity index 94%
rename from sample/src/main/java/com/joey/rxble/sample/ScanActivity.java
rename to sample/src/main/java/com/joey/sample/ScanActivity.java
index 14b0681..2e8c7c5 100644
--- a/sample/src/main/java/com/joey/rxble/sample/ScanActivity.java
+++ b/sample/src/main/java/com/joey/sample/ScanActivity.java
@@ -1,11 +1,11 @@
-package com.joey.rxble.sample;
+package com.joey.sample;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
-import android.support.v7.app.AppCompatActivity;
-import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.RecyclerView;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
@@ -13,12 +13,11 @@
import android.widget.TextView;
import android.widget.Toast;
-import com.joey.rxble.R;
import com.joey.rxble.RxBle;
import com.joey.rxble.RxBleOperator;
-import com.joey.rxble.sample.connect.ConnectActivity;
+import com.joey.sample.connect.ConnectActivity;
import com.joey.rxble.operation.RxBleTransformer;
-import com.joey.rxble.sample.util.HexString;
+import com.joey.sample.util.HexString;
import com.polidea.rxandroidble2.scan.ScanResult;
import java.util.UUID;
diff --git a/sample/src/main/java/com/joey/rxble/sample/ScanAdapter.java b/sample/src/main/java/com/joey/sample/ScanAdapter.java
similarity index 95%
rename from sample/src/main/java/com/joey/rxble/sample/ScanAdapter.java
rename to sample/src/main/java/com/joey/sample/ScanAdapter.java
index cfb2f76..3974cb0 100644
--- a/sample/src/main/java/com/joey/rxble/sample/ScanAdapter.java
+++ b/sample/src/main/java/com/joey/sample/ScanAdapter.java
@@ -1,13 +1,12 @@
-package com.joey.rxble.sample;
+package com.joey.sample;
-import android.support.annotation.NonNull;
-import android.support.v7.widget.RecyclerView;
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
-import com.joey.rxble.R;
import com.polidea.rxandroidble2.RxBleDevice;
import com.polidea.rxandroidble2.scan.ScanResult;
diff --git a/sample/src/main/java/com/joey/rxble/sample/connect/ConnectActivity.java b/sample/src/main/java/com/joey/sample/connect/ConnectActivity.java
similarity index 96%
rename from sample/src/main/java/com/joey/rxble/sample/connect/ConnectActivity.java
rename to sample/src/main/java/com/joey/sample/connect/ConnectActivity.java
index fdb9ff0..18aed59 100644
--- a/sample/src/main/java/com/joey/rxble/sample/connect/ConnectActivity.java
+++ b/sample/src/main/java/com/joey/sample/connect/ConnectActivity.java
@@ -1,14 +1,14 @@
-package com.joey.rxble.sample.connect;
+package com.joey.sample.connect;
import android.annotation.SuppressLint;
import android.bluetooth.BluetoothGattCharacteristic;
import android.bluetooth.BluetoothGattDescriptor;
import android.content.DialogInterface;
import android.os.Bundle;
-import android.support.v7.app.AlertDialog;
-import android.support.v7.app.AppCompatActivity;
-import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.RecyclerView;
+import androidx.appcompat.app.AlertDialog;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
@@ -17,11 +17,11 @@
import android.widget.TextView;
import android.widget.Toast;
-import com.joey.rxble.R;
import com.joey.rxble.RxBle;
import com.joey.rxble.RxBleOperator;
import com.joey.rxble.operation.RxBleTransformer;
-import com.joey.rxble.sample.util.HexString;
+import com.joey.sample.R;
+import com.joey.sample.util.HexString;
import com.polidea.rxandroidble2.NotificationSetupMode;
import com.polidea.rxandroidble2.RxBleConnection;
import com.polidea.rxandroidble2.RxBleDeviceServices;
@@ -33,6 +33,7 @@
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
+import io.reactivex.Single;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Function;
@@ -242,6 +243,7 @@ private void read(UUID result) {
}
private void refresh(RxBleDeviceServices rxBleDeviceServices) {
+ if (rxBleDeviceServices == null) return;
isConnect = true;
btConnect.setText("DisConnect");
rxBleDeviceServices.getBluetoothGattServices();
diff --git a/sample/src/main/java/com/joey/rxble/sample/connect/ConnectAdapter.java b/sample/src/main/java/com/joey/sample/connect/ConnectAdapter.java
similarity index 97%
rename from sample/src/main/java/com/joey/rxble/sample/connect/ConnectAdapter.java
rename to sample/src/main/java/com/joey/sample/connect/ConnectAdapter.java
index 7bfcbcf..8cddcb0 100644
--- a/sample/src/main/java/com/joey/rxble/sample/connect/ConnectAdapter.java
+++ b/sample/src/main/java/com/joey/sample/connect/ConnectAdapter.java
@@ -1,18 +1,18 @@
-package com.joey.rxble.sample.connect;
+package com.joey.sample.connect;
import android.bluetooth.BluetoothGattCharacteristic;
import android.bluetooth.BluetoothGattDescriptor;
import android.bluetooth.BluetoothGattService;
-import android.support.annotation.NonNull;
-import android.support.v7.widget.RecyclerView;
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.RecyclerView;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
-import com.joey.rxble.R;
import com.joey.rxble.RxBle;
+import com.joey.sample.R;
import java.util.ArrayList;
import java.util.List;
diff --git a/sample/src/main/java/com/joey/rxble/sample/permission/PermissionActivity.java b/sample/src/main/java/com/joey/sample/permission/PermissionActivity.java
similarity index 94%
rename from sample/src/main/java/com/joey/rxble/sample/permission/PermissionActivity.java
rename to sample/src/main/java/com/joey/sample/permission/PermissionActivity.java
index 14fc009..e85a8fb 100644
--- a/sample/src/main/java/com/joey/rxble/sample/permission/PermissionActivity.java
+++ b/sample/src/main/java/com/joey/sample/permission/PermissionActivity.java
@@ -1,4 +1,4 @@
-package com.joey.rxble.sample.permission;
+package com.joey.sample.permission;
/**
* /**
@@ -8,11 +8,11 @@
*/
import android.content.DialogInterface;
import android.os.Bundle;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import android.support.v4.app.ActivityCompat;
-import android.support.v7.app.AlertDialog;
-import android.support.v7.app.AppCompatActivity;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.core.app.ActivityCompat;
+import androidx.appcompat.app.AlertDialog;
+import androidx.appcompat.app.AppCompatActivity;
import android.text.TextUtils;
import java.io.Serializable;
diff --git a/sample/src/main/java/com/joey/rxble/sample/permission/PermissionListener.java b/sample/src/main/java/com/joey/sample/permission/PermissionListener.java
similarity index 81%
rename from sample/src/main/java/com/joey/rxble/sample/permission/PermissionListener.java
rename to sample/src/main/java/com/joey/sample/permission/PermissionListener.java
index eebd267..4a38a64 100644
--- a/sample/src/main/java/com/joey/rxble/sample/permission/PermissionListener.java
+++ b/sample/src/main/java/com/joey/sample/permission/PermissionListener.java
@@ -1,6 +1,6 @@
-package com.joey.rxble.sample.permission;
+package com.joey.sample.permission;
-import android.support.annotation.NonNull;
+import androidx.annotation.NonNull;
/**
* /**
diff --git a/sample/src/main/java/com/joey/rxble/sample/permission/PermissionUtil.java b/sample/src/main/java/com/joey/sample/permission/PermissionUtil.java
similarity index 96%
rename from sample/src/main/java/com/joey/rxble/sample/permission/PermissionUtil.java
rename to sample/src/main/java/com/joey/sample/permission/PermissionUtil.java
index afb86d5..a41d3cc 100644
--- a/sample/src/main/java/com/joey/rxble/sample/permission/PermissionUtil.java
+++ b/sample/src/main/java/com/joey/sample/permission/PermissionUtil.java
@@ -1,4 +1,4 @@
-package com.joey.rxble.sample.permission;
+package com.joey.sample.permission;
import android.app.Activity;
import android.content.Intent;
@@ -6,9 +6,9 @@
import android.net.Uri;
import android.os.Build;
import android.provider.Settings;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import android.support.v4.content.PermissionChecker;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.core.content.PermissionChecker;
import android.util.Log;
import java.io.Serializable;
diff --git a/sample/src/main/java/com/joey/rxble/sample/util/HexString.java b/sample/src/main/java/com/joey/sample/util/HexString.java
similarity index 96%
rename from sample/src/main/java/com/joey/rxble/sample/util/HexString.java
rename to sample/src/main/java/com/joey/sample/util/HexString.java
index 718d560..906d834 100644
--- a/sample/src/main/java/com/joey/rxble/sample/util/HexString.java
+++ b/sample/src/main/java/com/joey/sample/util/HexString.java
@@ -1,4 +1,4 @@
-package com.joey.rxble.sample.util;
+package com.joey.sample.util;
public class HexString {
diff --git a/sample/src/main/res/layout/activity_connect.xml b/sample/src/main/res/layout/activity_connect.xml
index 7be9fff..29e7132 100644
--- a/sample/src/main/res/layout/activity_connect.xml
+++ b/sample/src/main/res/layout/activity_connect.xml
@@ -40,7 +40,7 @@
android:hint="write bytes"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
-
-