Commit 2f5d6c4f58442dcf986c30238c93be8c51d3ecb4

Authored by YangShuai
1 parent 75eb85c2

1 修复添加小家音箱时允许蓝牙后返回点击下一步APP闪退回添加页面的问题

config.gradle
... ... @@ -21,7 +21,7 @@ ext {
21 21 //编译方式
22 22 debug : false,
23 23 //版本号
24   - version: "0.3.28",
  24 + version: "0.3.29",
25 25 //Lib库前缀
26 26 packeg : "com.cnlive.module",
27 27 //Lib库名称
... ...
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/fragment/SearchDevicefragment.java
... ... @@ -27,6 +27,7 @@ import org.greenrobot.eventbus.ThreadMode;
27 27 * @author ys
28 28 */
29 29 public class SearchDevicefragment extends MvpBindingFragment<SearchDevicefragmentView, SearchDevicefragmentPresenter, Object, FragmentSearchDeviceBinding> {
  30 + private Handler myHandler;
30 31  
31 32 @Override
32 33 protected int getLayoutId() {
... ... @@ -37,7 +38,9 @@ public class SearchDevicefragment extends MvpBindingFragment&lt;SearchDevicefragmen
37 38 public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
38 39 super.onViewCreated(view, savedInstanceState);
39 40 EventBusUtil.register(this);
40   -
  41 + if (null == myHandler) {
  42 + myHandler = new Handler();
  43 + }
41 44 initTopBar();
42 45 if (BleManager.getInstance().isBlueEnable()) {
43 46 initBlueToothScanConfig();
... ... @@ -45,7 +48,7 @@ public class SearchDevicefragment extends MvpBindingFragment&lt;SearchDevicefragmen
45 48 getMvpView().initListAdapter();
46 49 }
47 50 } else {
48   - new Handler().postDelayed(new Runnable() {
  51 + myHandler.postDelayed(new Runnable() {
49 52 @Override
50 53 public void run() {
51 54 initBlueToothScanConfig();
... ... @@ -105,6 +108,9 @@ public class SearchDevicefragment extends MvpBindingFragment&lt;SearchDevicefragmen
105 108 @Override
106 109 public void onDestroy() {
107 110 super.onDestroy();
  111 + if (null != myHandler) {
  112 + myHandler.removeCallbacksAndMessages(null);
  113 + }
108 114 try {
109 115 BleManager.getInstance().cancelScan();
110 116 } catch (Exception e) {
... ... @@ -127,4 +133,5 @@ public class SearchDevicefragment extends MvpBindingFragment&lt;SearchDevicefragmen
127 133 // }
128 134 // }
129 135 }
  136 +
130 137 }
... ...