Commit efb73d2aed654897de74a41908b3eaeae374e560

Authored by YangShuai
1 parent da6e9875

1 修复配网成功后,点击完成按钮,所有设备列表未刷新的情况

module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/view/SelectWifiFragmentView.java
... ... @@ -218,6 +218,7 @@ public class SelectWifiFragmentView implements MvpView {
218 218 public void onConnectFail(BleDevice bleDevice, BleException exception) {
219 219 QMUITipDialogUtil.dismessDialog();
220 220 AlertUtil.showDeftToast(getContext(), "连接无响应,请稍后重试");
  221 + EventBus.getDefault().post(new EventMsg(EventMsg.DEVICE_NOT_RESPONSE,""));
221 222 }
222 223  
223 224 // 连接成功,BleDevice即为所连接的BLE设备
... ...
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/model/message/EventMsg.java
... ... @@ -10,6 +10,7 @@ public class EventMsg {
10 10 public static final int HAS_FRIEND_REMOVE_FRIMALY = 6;//有好友移除家庭
11 11 public static final int HAS_ROLE_USED = 7;//已经有角色被占用了
12 12 public static final int CONFIG_NET_SUCCESS = 8;//配网成功
  13 + public static final int DEVICE_NOT_RESPONSE = 9;//蓝牙设备无响应
13 14  
14 15 private int eventType;
15 16 private Object data;
... ...
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/adapter/BluetoothDeviceAdapter.java
... ... @@ -66,7 +66,7 @@ import java.util.List;
66 66 if (null != bluetoothDeviceList) {
67 67 boolean isHave = false;
68 68 for (int i = 0; i < bluetoothDeviceList.size(); i++) {
69   - if (bleDevice.getName().equals(bluetoothDeviceList.get(i).getName())) {
  69 + if (bleDevice.getMac().equals(bluetoothDeviceList.get(i).getMac())) {
70 70 isHave = true;
71 71 break;
72 72 }
... ...
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/fragment/SearchDevicefragment.java
... ... @@ -117,5 +117,12 @@ public class SearchDevicefragment extends MvpBindingFragment&lt;SearchDevicefragmen
117 117 } else if (EventMsg.GO_TO_CHINA_LISTEN_PAGE == msg.getEventType()) {
118 118 getActivity().finish();
119 119 }
  120 +// else if (EventMsg.DEVICE_NOT_RESPONSE == msg.getEventType()) {
  121 +// BleManager.getInstance().cancelScan();
  122 +// //设备无响应
  123 +// if (null != getMvpView()) {
  124 +// getMvpView().initListAdapter();
  125 +// }
  126 +// }
120 127 }
121 128 }
... ...
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/fragment/SelectWifiFragment.java
... ... @@ -129,6 +129,9 @@ public class SelectWifiFragment extends MvpBindingFragment&lt;SelectWifiFragmentVie
129 129 getActivity().finish();
130 130 } else if (EventMsg.GO_TO_CHINA_LISTEN_PAGE == msg.getEventType()) {
131 131 getActivity().finish();
  132 + } else if (EventMsg.DEVICE_NOT_RESPONSE == msg.getEventType()) {
  133 + //设备无响应
  134 + getActivity().finish();
132 135 }
133 136 }
134 137 }
... ...