diff --git a/README.md b/README.md index d96e23a..2baae77 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Add the dependency to the **Module** gradle file: ```gradle dependencies { ... - compile 'com.github.phearme:bt-scan-selector:1.1.6' + compile 'com.github.phearme:bt-scan-selector:1.1.7' } ``` Enable databinding in the **Module** grade file: diff --git a/btscanselector/build.gradle b/btscanselector/build.gradle index ff1db4e..f498485 100644 --- a/btscanselector/build.gradle +++ b/btscanselector/build.gradle @@ -7,8 +7,8 @@ android { defaultConfig { minSdkVersion 14 targetSdkVersion 26 - versionCode 19 - versionName "1.1.6" + versionCode 20 + versionName "1.1.7" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" diff --git a/btscanselector/src/main/java/com/phearme/btscanselector/BTScanResultItem.java b/btscanselector/src/main/java/com/phearme/btscanselector/BTScanResultItem.java index 7759691..64d7aca 100644 --- a/btscanselector/src/main/java/com/phearme/btscanselector/BTScanResultItem.java +++ b/btscanselector/src/main/java/com/phearme/btscanselector/BTScanResultItem.java @@ -32,19 +32,16 @@ private void updateIconResId() { iconResourceId = R.drawable.network_high; return; } - if (rssi <= -50 && rssi > -70) { + if (rssi > -70) { iconResourceId = R.drawable.network_medium; return; } - if (rssi <= -70 && rssi > -90) { + if (rssi > -90) { iconResourceId = R.drawable.network_low; return; } - if (rssi <= -90) { - iconResourceId = R.drawable.network_no_signal; - return; - } - iconResourceId = R.drawable.network_null; + iconResourceId = R.drawable.network_no_signal; + //iconResourceId = R.drawable.network_null; } public int getIconResourceId() { diff --git a/btscanselector/src/main/java/com/phearme/btscanselector/BTScanSelectorDialog.java b/btscanselector/src/main/java/com/phearme/btscanselector/BTScanSelectorDialog.java index b5126cb..c628820 100644 --- a/btscanselector/src/main/java/com/phearme/btscanselector/BTScanSelectorDialog.java +++ b/btscanselector/src/main/java/com/phearme/btscanselector/BTScanSelectorDialog.java @@ -85,13 +85,16 @@ public void setTitle(String title) { @Override public void onDestroy() { - if (mAdapter != null) { + if (mAdapter != null && getActivity() != null) { mAdapter.terminate(getActivity()); } super.onDestroy(); } private void bindRecyclerView() { + if (getActivity() == null) { + return; + } if (getActivity().checkCallingOrSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(getActivity(), new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_LOCATION_PERMISSION); return;