Commit c7d0560663d27325b06eb7a2504e4221519a6a55
1 parent
1bccbe45
1 修改配网完成逻辑
Showing
2 changed files
with
21 additions
and
3 deletions
config.gradle
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/activity/ConnBluetoothSuccessActivity.java
| ... | ... | @@ -16,10 +16,13 @@ import com.cnlive.strike.xiaojiaspeaker.commonInfo.XiaoJIaCommInfo; |
| 16 | 16 | import com.cnlive.strike.xiaojiaspeaker.databinding.ActivityConnBluetoothSuccessBinding; |
| 17 | 17 | import com.cnlive.strike.xiaojiaspeaker.model.message.EventMsg; |
| 18 | 18 | import com.cnlive.strike.xiaojiaspeaker.netWork.bean.NetworkResultBean; |
| 19 | +import com.cnlive.strike.xiaojiaspeaker.util.EventBusUtil; | |
| 19 | 20 | import com.daimajia.androidanimations.library.Techniques; |
| 20 | 21 | import com.daimajia.androidanimations.library.YoYo; |
| 21 | 22 | |
| 22 | 23 | import org.greenrobot.eventbus.EventBus; |
| 24 | +import org.greenrobot.eventbus.Subscribe; | |
| 25 | +import org.greenrobot.eventbus.ThreadMode; | |
| 23 | 26 | |
| 24 | 27 | /** |
| 25 | 28 | * 音箱连接成功页面 |
| ... | ... | @@ -33,6 +36,7 @@ public class ConnBluetoothSuccessActivity extends AppCompatActivity { |
| 33 | 36 | @Override |
| 34 | 37 | protected void onCreate(Bundle savedInstanceState) { |
| 35 | 38 | super.onCreate(savedInstanceState); |
| 39 | + EventBusUtil.register(this); | |
| 36 | 40 | binding = DataBindingUtil.setContentView(this, R.layout.activity_conn_bluetooth_success); |
| 37 | 41 | if (null != getIntent().getExtras()) { |
| 38 | 42 | networkResultBean = (NetworkResultBean) getIntent().getExtras().getSerializable("networkResultBean"); |
| ... | ... | @@ -41,6 +45,20 @@ public class ConnBluetoothSuccessActivity extends AppCompatActivity { |
| 41 | 45 | initView(); |
| 42 | 46 | } |
| 43 | 47 | |
| 48 | + @Override | |
| 49 | + protected void onDestroy() { | |
| 50 | + super.onDestroy(); | |
| 51 | + EventBusUtil.unRegister(this); | |
| 52 | + | |
| 53 | + } | |
| 54 | + | |
| 55 | + @Subscribe(threadMode = ThreadMode.MAIN) | |
| 56 | + public void event(EventMsg msg) { | |
| 57 | + if (EventMsg.INVIT_FRIEND_SUCCESS == msg.getEventType()) { | |
| 58 | + finish(); | |
| 59 | + } | |
| 60 | + } | |
| 61 | + | |
| 44 | 62 | private void initView() { |
| 45 | 63 | //判断是否显示礼物弹窗 |
| 46 | 64 | boolean isShow = XiaoJIaCommInfo.getIsShowConnGift(this); |
| ... | ... | @@ -53,7 +71,7 @@ public class ConnBluetoothSuccessActivity extends AppCompatActivity { |
| 53 | 71 | binding.tvGoToListenChina.setOnClickListener(new View.OnClickListener() { |
| 54 | 72 | @Override |
| 55 | 73 | public void onClick(View view) { |
| 56 | - EventBus.getDefault().post(new EventMsg(EventMsg.GO_TO_CHINA_LISTEN_PAGE,"")); | |
| 74 | + EventBus.getDefault().post(new EventMsg(EventMsg.GO_TO_CHINA_LISTEN_PAGE, "")); | |
| 57 | 75 | finish(); |
| 58 | 76 | } |
| 59 | 77 | }); |
| ... | ... | @@ -74,7 +92,7 @@ public class ConnBluetoothSuccessActivity extends AppCompatActivity { |
| 74 | 92 | binding.btnInvitFriend.setOnClickListener(new View.OnClickListener() { |
| 75 | 93 | @Override |
| 76 | 94 | public void onClick(View view) { |
| 77 | - SelectIMFriendActivity.startActivity(ConnBluetoothSuccessActivity.this,XiaoJIaCommInfo.getFamilyId(ConnBluetoothSuccessActivity.this)); | |
| 95 | + SelectIMFriendActivity.startActivity(ConnBluetoothSuccessActivity.this, XiaoJIaCommInfo.getFamilyId(ConnBluetoothSuccessActivity.this)); | |
| 78 | 96 | } |
| 79 | 97 | }); |
| 80 | 98 | //修改音箱名称 | ... | ... |