Commit 28ef8fe7f2b0bfdb2d5f43cea7632b4d96a9f583
1 parent
82fcfd7f
1 修改移除家庭成员逻辑
Showing
14 changed files
with
116 additions
and
41 deletions
app/src/main/java/com/cnlive/strike/xiaojiaspeaker/MyApp.java
| ... | ... | @@ -13,13 +13,13 @@ public class MyApp extends Application { |
| 13 | 13 | super.onCreate(); |
| 14 | 14 | initARouter(); |
| 15 | 15 | String userId = ""; |
| 16 | -// AppConfig.init(this, BuildConfig.APP_ID, BuildConfig.APP_KEY, | |
| 17 | -// BuildConfig.APP_SCERET, BuildConfig.SPECIAL_GROUP_MEMBER_LIMIT, | |
| 18 | -// BuildConfig.VERSION_AS_DEBUG, "","", | |
| 19 | -// "", "", | |
| 20 | -// "","", "", | |
| 21 | -// "", "","", | |
| 22 | -// BuildConfig.BAIDU_MAP_APP_KEY, ""); | |
| 16 | + AppConfig.init(this, BuildConfig.APP_ID, BuildConfig.APP_KEY, | |
| 17 | + BuildConfig.APP_SCERET, BuildConfig.SPECIAL_GROUP_MEMBER_LIMIT, | |
| 18 | + BuildConfig.VERSION_AS_DEBUG, "","", | |
| 19 | + "10514333", "", | |
| 20 | + "","", "", | |
| 21 | + "", "","", | |
| 22 | + BuildConfig.BAIDU_MAP_APP_KEY, ""); | |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/presenter/ChangeDeviceNamePresenter.java
| ... | ... | @@ -9,6 +9,7 @@ import com.cnlive.libs.base.logic.Logic; |
| 9 | 9 | import com.cnlive.libs.base.logic.callback.DataCallback; |
| 10 | 10 | import com.cnlive.libs.base.logic.callback.FailureCallback; |
| 11 | 11 | import com.cnlive.libs.base.logic.callback.SuccessCallback; |
| 12 | +import com.cnlive.libs.base.util.AlertUtil; | |
| 12 | 13 | import com.cnlive.strike.xiaojiaspeaker.frame.view.ChangeDeviceNameView; |
| 13 | 14 | import com.cnlive.strike.xiaojiaspeaker.model.message.EventMsg; |
| 14 | 15 | import com.cnlive.strike.xiaojiaspeaker.netWork.ApiServiceXiaoJia; |
| ... | ... | @@ -54,18 +55,8 @@ public class ChangeDeviceNamePresenter extends MvpBasePresenter<ChangeDeviceName |
| 54 | 55 | } |
| 55 | 56 | EventBus.getDefault().post(new EventMsg(EventMsg.CHANGE_DEVICE_NAME_SUCCESS, newName)); |
| 56 | 57 | QMUITipDialogUtil.dismessDialog(); |
| 57 | - QMUITipDialogUtil.successDialog(context, "保存成功", 1); | |
| 58 | - new Handler().postDelayed(new Runnable() { | |
| 59 | - @Override | |
| 60 | - public void run() { | |
| 61 | - if (null != onResponseListener) { | |
| 62 | - if (null == getView()) { | |
| 63 | - return; | |
| 64 | - } | |
| 65 | - onResponseListener.onSuccess(); | |
| 66 | - } | |
| 67 | - } | |
| 68 | - }, 1000); | |
| 58 | + AlertUtil.showDeftToast(context, "保存成功"); | |
| 59 | + onResponseListener.onSuccess(); | |
| 69 | 60 | } |
| 70 | 61 | }) |
| 71 | 62 | .setFailureCallback(new FailureCallback() { |
| ... | ... | @@ -77,7 +68,7 @@ public class ChangeDeviceNamePresenter extends MvpBasePresenter<ChangeDeviceName |
| 77 | 68 | return; |
| 78 | 69 | } |
| 79 | 70 | QMUITipDialogUtil.dismessDialog(); |
| 80 | - QMUITipDialogUtil.failedDialog(context, s, 1); | |
| 71 | + AlertUtil.showDeftToast(context,s); | |
| 81 | 72 | } |
| 82 | 73 | }) |
| 83 | 74 | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/presenter/ChangeWifiFragmentPresenter.java
| ... | ... | @@ -7,6 +7,7 @@ import com.cnlive.libs.base.logic.Logic; |
| 7 | 7 | import com.cnlive.libs.base.logic.callback.DataCallback; |
| 8 | 8 | import com.cnlive.libs.base.logic.callback.FailureCallback; |
| 9 | 9 | import com.cnlive.libs.base.logic.callback.SuccessCallback; |
| 10 | +import com.cnlive.libs.base.util.AlertUtil; | |
| 10 | 11 | import com.cnlive.strike.xiaojiaspeaker.frame.view.ChangeWifiFragmentView; |
| 11 | 12 | import com.cnlive.strike.xiaojiaspeaker.frame.view.SelectWifiFragmentView; |
| 12 | 13 | import com.cnlive.strike.xiaojiaspeaker.model.message.EventMsg; |
| ... | ... | @@ -52,7 +53,7 @@ public class ChangeWifiFragmentPresenter extends MvpBasePresenter<ChangeWifiFrag |
| 52 | 53 | return; |
| 53 | 54 | } |
| 54 | 55 | QMUITipDialogUtil.dismessDialog(); |
| 55 | - QMUITipDialogUtil.successDialog(context, baseInfo.getMessage(), 1); | |
| 56 | + AlertUtil.showDeftToast(context,baseInfo.getMessage()); | |
| 56 | 57 | Log.e(TAG, "onSuccess: " + baseInfo.getMessage()); |
| 57 | 58 | if (null != onResponseListener) { |
| 58 | 59 | onResponseListener.onSuccess(); |
| ... | ... | @@ -68,7 +69,7 @@ public class ChangeWifiFragmentPresenter extends MvpBasePresenter<ChangeWifiFrag |
| 68 | 69 | return; |
| 69 | 70 | } |
| 70 | 71 | QMUITipDialogUtil.dismessDialog(); |
| 71 | - QMUITipDialogUtil.failedDialog(context, s, 1); | |
| 72 | + AlertUtil.showDeftToast(context,s); | |
| 72 | 73 | } |
| 73 | 74 | }) |
| 74 | 75 | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/presenter/DeviceManagerFragmentPresenter.java
| ... | ... | @@ -7,6 +7,7 @@ import com.cnlive.libs.base.logic.Logic; |
| 7 | 7 | import com.cnlive.libs.base.logic.callback.DataCallback; |
| 8 | 8 | import com.cnlive.libs.base.logic.callback.FailureCallback; |
| 9 | 9 | import com.cnlive.libs.base.logic.callback.SuccessCallback; |
| 10 | +import com.cnlive.libs.base.util.AlertUtil; | |
| 10 | 11 | import com.cnlive.strike.xiaojiaspeaker.frame.view.DeviceManagerFragmentView; |
| 11 | 12 | import com.cnlive.strike.xiaojiaspeaker.model.message.EventMsg; |
| 12 | 13 | import com.cnlive.strike.xiaojiaspeaker.netWork.ApiServiceXiaoJia; |
| ... | ... | @@ -18,6 +19,7 @@ import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; |
| 18 | 19 | |
| 19 | 20 | import org.greenrobot.eventbus.EventBus; |
| 20 | 21 | |
| 22 | +import java.util.ArrayList; | |
| 21 | 23 | import java.util.HashMap; |
| 22 | 24 | import java.util.Map; |
| 23 | 25 | |
| ... | ... | @@ -57,7 +59,7 @@ public class DeviceManagerFragmentPresenter extends MvpBasePresenter<DeviceManag |
| 57 | 59 | return; |
| 58 | 60 | } |
| 59 | 61 | QMUITipDialogUtil.dismessDialog(); |
| 60 | - QMUITipDialogUtil.failedDialog(context, s, 1); | |
| 62 | + AlertUtil.showDeftToast(context,s); | |
| 61 | 63 | } |
| 62 | 64 | }) |
| 63 | 65 | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/presenter/SetFriendsRolePresenter.java
| ... | ... | @@ -2,6 +2,7 @@ package com.cnlive.strike.xiaojiaspeaker.frame.presenter; |
| 2 | 2 | |
| 3 | 3 | import android.app.Activity; |
| 4 | 4 | import android.content.Context; |
| 5 | +import android.os.Handler; | |
| 5 | 6 | import android.util.Log; |
| 6 | 7 | import android.view.View; |
| 7 | 8 | |
| ... | ... | @@ -9,7 +10,9 @@ import com.cnlive.libs.base.logic.Logic; |
| 9 | 10 | import com.cnlive.libs.base.logic.callback.DataCallback; |
| 10 | 11 | import com.cnlive.libs.base.logic.callback.FailureCallback; |
| 11 | 12 | import com.cnlive.libs.base.logic.callback.SuccessCallback; |
| 13 | +import com.cnlive.libs.base.util.AlertUtil; | |
| 12 | 14 | import com.cnlive.strike.xiaojiaspeaker.frame.view.SetFriendsRoleView; |
| 15 | +import com.cnlive.strike.xiaojiaspeaker.model.message.EventMsg; | |
| 13 | 16 | import com.cnlive.strike.xiaojiaspeaker.netWork.ApiServiceCMCC; |
| 14 | 17 | import com.cnlive.strike.xiaojiaspeaker.netWork.ApiServiceXiaoJia; |
| 15 | 18 | import com.cnlive.strike.xiaojiaspeaker.netWork.CmccRequest; |
| ... | ... | @@ -22,6 +25,8 @@ import com.cnlive.strike.xiaojiaspeaker.util.QMUITipDialogUtil; |
| 22 | 25 | import com.cnlive.strike.xiaojiaspeaker.util.subutil.util.http.Request; |
| 23 | 26 | import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; |
| 24 | 27 | |
| 28 | +import org.greenrobot.eventbus.EventBus; | |
| 29 | + | |
| 25 | 30 | import java.util.HashMap; |
| 26 | 31 | import java.util.Map; |
| 27 | 32 | |
| ... | ... | @@ -38,11 +43,11 @@ public class SetFriendsRolePresenter extends MvpBasePresenter<SetFriendsRoleView |
| 38 | 43 | |
| 39 | 44 | |
| 40 | 45 | public void queryConfigDeviceNetResult(Activity context, String contactsInvite) { |
| 41 | - InvitFamilyBean1 bean1=new InvitFamilyBean1(); | |
| 46 | + InvitFamilyBean1 bean1 = new InvitFamilyBean1(); | |
| 42 | 47 | bean1.setType("2"); |
| 43 | 48 | bean1.setContactsInvite(GsonUtil.jsonToList(contactsInvite, InvitFamilyBean1.ContactsInviteBean.class)); |
| 44 | 49 | |
| 45 | - CmccRequest.getInstance(context,ApiServiceCMCC.class) | |
| 50 | + CmccRequest.getInstance(context, ApiServiceCMCC.class) | |
| 46 | 51 | .invitFamilyMember(bean1) |
| 47 | 52 | .enqueue(new Callback<APIBaseInfo>() { |
| 48 | 53 | @Override |
| ... | ... | @@ -80,12 +85,12 @@ public class SetFriendsRolePresenter extends MvpBasePresenter<SetFriendsRoleView |
| 80 | 85 | } |
| 81 | 86 | QMUITipDialogUtil.loadingDialog(context, "请稍后", true); |
| 82 | 87 | Map<String, String> map = new HashMap<>(); |
| 83 | - map.put("type","2");//联系人邀请 | |
| 88 | + map.put("type", "2");//联系人邀请 | |
| 84 | 89 | map.put("contactsInvite", contactsInvite); |
| 85 | 90 | Logic.create(map) |
| 86 | - .action(new Logic.Action< Map<String, String> , APIBaseInfo>() { | |
| 91 | + .action(new Logic.Action<Map<String, String>, APIBaseInfo>() { | |
| 87 | 92 | @Override |
| 88 | - public Disposable action(Map<String, String> map , DataCallback<APIBaseInfo> dataCallback) { | |
| 93 | + public Disposable action(Map<String, String> map, DataCallback<APIBaseInfo> dataCallback) { | |
| 89 | 94 | return SubscriptionRequest.service(ApiServiceXiaoJia.class, api -> api.invitFamilyMember(map)).subscribe(context, dataCallback); |
| 90 | 95 | } |
| 91 | 96 | }).<APIBaseInfo>event() |
| ... | ... | @@ -98,7 +103,8 @@ public class SetFriendsRolePresenter extends MvpBasePresenter<SetFriendsRoleView |
| 98 | 103 | return; |
| 99 | 104 | } |
| 100 | 105 | QMUITipDialogUtil.dismessDialog(); |
| 101 | - QMUITipDialogUtil.successDialog(context, "邀请成功", 1); | |
| 106 | + AlertUtil.showDeftToast(context,"邀请成功"); | |
| 107 | + EventBus.getDefault().post(new EventMsg(EventMsg.INVIT_FRIEND_SUCCESS,null)); | |
| 102 | 108 | } |
| 103 | 109 | }) |
| 104 | 110 | .setFailureCallback(new FailureCallback() { |
| ... | ... | @@ -110,7 +116,7 @@ public class SetFriendsRolePresenter extends MvpBasePresenter<SetFriendsRoleView |
| 110 | 116 | return; |
| 111 | 117 | } |
| 112 | 118 | QMUITipDialogUtil.dismessDialog(); |
| 113 | - QMUITipDialogUtil.failedDialog(context, s, 1); | |
| 119 | + AlertUtil.showDeftToast(context,s); | |
| 114 | 120 | } |
| 115 | 121 | }) |
| 116 | 122 | |
| ... | ... | @@ -169,4 +175,8 @@ public class SetFriendsRolePresenter extends MvpBasePresenter<SetFriendsRoleView |
| 169 | 175 | |
| 170 | 176 | .start(); |
| 171 | 177 | } |
| 178 | + | |
| 179 | + public interface OnResposeListener { | |
| 180 | + void onSuccess(); | |
| 181 | + } | |
| 172 | 182 | } | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/presenter/UserManagerPresenter.java
| ... | ... | @@ -9,6 +9,7 @@ import com.cnlive.libs.base.logic.Logic; |
| 9 | 9 | import com.cnlive.libs.base.logic.callback.DataCallback; |
| 10 | 10 | import com.cnlive.libs.base.logic.callback.FailureCallback; |
| 11 | 11 | import com.cnlive.libs.base.logic.callback.SuccessCallback; |
| 12 | +import com.cnlive.libs.base.util.AlertUtil; | |
| 12 | 13 | import com.cnlive.strike.xiaojiaspeaker.frame.view.UserManagerView; |
| 13 | 14 | import com.cnlive.strike.xiaojiaspeaker.netWork.ApiServiceXiaoJia; |
| 14 | 15 | import com.cnlive.strike.xiaojiaspeaker.netWork.bean.FamilyRoleBean; |
| ... | ... | @@ -76,7 +77,7 @@ public class UserManagerPresenter extends MvpBasePresenter<UserManagerView> { |
| 76 | 77 | return; |
| 77 | 78 | } |
| 78 | 79 | QMUITipDialogUtil.dismessDialog(); |
| 79 | - QMUITipDialogUtil.failedDialog(context, s, 1); | |
| 80 | + AlertUtil.showDeftToast(context,s); | |
| 80 | 81 | //显示重试 |
| 81 | 82 | Log.e(TAG, "onFailure: " + s); |
| 82 | 83 | } |
| ... | ... | @@ -175,7 +176,7 @@ public class UserManagerPresenter extends MvpBasePresenter<UserManagerView> { |
| 175 | 176 | } |
| 176 | 177 | //显示重试 |
| 177 | 178 | QMUITipDialogUtil.dismessDialog(); |
| 178 | - QMUITipDialogUtil.failedDialog(context, s, 1); | |
| 179 | + AlertUtil.showDeftToast(context,s); | |
| 179 | 180 | } |
| 180 | 181 | }) |
| 181 | 182 | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/view/SelectWifiFragmentView.java
| ... | ... | @@ -65,7 +65,7 @@ public class SelectWifiFragmentView implements MvpView { |
| 65 | 65 | if (isSetNetSuccess) { |
| 66 | 66 | if (null != getContext()) { |
| 67 | 67 | QMUITipDialogUtil.dismessDialog(); |
| 68 | - QMUITipDialogUtil.failedDialog(getContext(), "配网超时", 1); | |
| 68 | + AlertUtil.showDeftToast(getContext(), "配网超时"); | |
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | } |
| ... | ... | @@ -212,7 +212,7 @@ public class SelectWifiFragmentView implements MvpView { |
| 212 | 212 | // 连接失败 |
| 213 | 213 | @Override |
| 214 | 214 | public void onConnectFail(BleDevice bleDevice, BleException exception) { |
| 215 | - QMUITipDialogUtil.failedDialog(getContext(), "连接失败,请重试...", 2); | |
| 215 | + AlertUtil.showDeftToast(getContext(), "连接失败,请重试..."); | |
| 216 | 216 | Log.e(TAG, "onConnectFail: " + exception); |
| 217 | 217 | } |
| 218 | 218 | |
| ... | ... | @@ -247,7 +247,7 @@ public class SelectWifiFragmentView implements MvpView { |
| 247 | 247 | @Override |
| 248 | 248 | public void onWriteFailure(BleException exception) { |
| 249 | 249 | Log.e(TAG, "onWriteFailure: "); |
| 250 | - QMUITipDialogUtil.failedDialog(getContext(), "连接失败,请重试...", 2); | |
| 250 | + AlertUtil.showDeftToast(getContext(), "连接失败,请重试..."); | |
| 251 | 251 | |
| 252 | 252 | } |
| 253 | 253 | }); |
| ... | ... | @@ -257,8 +257,7 @@ public class SelectWifiFragmentView implements MvpView { |
| 257 | 257 | @Override |
| 258 | 258 | public void onNotifyFailure(BleException exception) { |
| 259 | 259 | Log.e(TAG, "onNotifyFailure: " + exception); |
| 260 | - QMUITipDialogUtil.failedDialog(getContext(), "连接失败,请重试...", 2); | |
| 261 | - | |
| 260 | + AlertUtil.showDeftToast(getContext(), "连接失败,请重试..."); | |
| 262 | 261 | } |
| 263 | 262 | |
| 264 | 263 | @Override | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/view/SetFriendsRoleView.java
| ... | ... | @@ -9,6 +9,7 @@ import android.view.View; |
| 9 | 9 | |
| 10 | 10 | import com.cnlive.libs.base.util.AlertUtil; |
| 11 | 11 | import com.cnlive.strike.xiaojiaspeaker.R; |
| 12 | +import com.cnlive.strike.xiaojiaspeaker.frame.presenter.SetFriendsRolePresenter; | |
| 12 | 13 | import com.cnlive.strike.xiaojiaspeaker.model.RoleInfo; |
| 13 | 14 | import com.cnlive.strike.xiaojiaspeaker.netWork.bean.RoleNetBean; |
| 14 | 15 | import com.cnlive.strike.xiaojiaspeaker.ui.adapter.SetRoleAdapter; | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/view/UserManagerView.java
| ... | ... | @@ -190,7 +190,7 @@ public class UserManagerView implements MvpView { |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | public void addAdminBtn() { |
| 193 | - //添加邀请者按钮 | |
| 193 | + fragment.binding.topbar.removeAllRightViews(); //添加邀请者按钮 | |
| 194 | 194 | btn_invit = fragment.binding.topbar.addRightTextButton("邀请使用者", R.id.rightBtn); |
| 195 | 195 | btn_invit.setTextSize(15); |
| 196 | 196 | btn_invit.setTextColor(ContextCompat.getColor(getContext(), R.color.color_282828)); | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/model/message/EventMsg.java
| ... | ... | @@ -3,7 +3,8 @@ package com.cnlive.strike.xiaojiaspeaker.model.message; |
| 3 | 3 | public class EventMsg { |
| 4 | 4 | public static final int CHANGE_DEVICE_NAME_SUCCESS = 0;//修改时设备名称成功 |
| 5 | 5 | public static final int DELETE_DEVICE_NAME_SUCCESS = 1;//删除设备成功 |
| 6 | - public static final int CLOSE_BLUETOOTH_ACTIVITY = 0;//关闭配网页面 | |
| 6 | + public static final int CLOSE_BLUETOOTH_ACTIVITY = 2;//关闭配网页面 | |
| 7 | + public static final int INVIT_FRIEND_SUCCESS = 3;//邀请好友成功页面 | |
| 7 | 8 | |
| 8 | 9 | private int eventType; |
| 9 | 10 | private Object data; | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/activity/RemoteControlActivity.java
| ... | ... | @@ -15,6 +15,7 @@ import com.cnlive.libs.base.logic.Logic; |
| 15 | 15 | import com.cnlive.libs.base.logic.callback.DataCallback; |
| 16 | 16 | import com.cnlive.libs.base.logic.callback.FailureCallback; |
| 17 | 17 | import com.cnlive.libs.base.logic.callback.SuccessCallback; |
| 18 | +import com.cnlive.libs.base.util.AlertUtil; | |
| 18 | 19 | import com.cnlive.libs.base.util.StatusBarUtil; |
| 19 | 20 | import com.cnlive.libs.base.util.StatusBarUtil2; |
| 20 | 21 | import com.cnlive.strike.xiaojiaspeaker.R; |
| ... | ... | @@ -215,7 +216,7 @@ public class RemoteControlActivity extends AppCompatActivity { |
| 215 | 216 | setRemoteBtnState(false); |
| 216 | 217 | //显示重试 |
| 217 | 218 | QMUITipDialogUtil.dismessDialog(); |
| 218 | - QMUITipDialogUtil.failedDialog(context, s, 1); | |
| 219 | + AlertUtil.showDeftToast(context,s); | |
| 219 | 220 | } |
| 220 | 221 | }) |
| 221 | 222 | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/fragment/SelectIMFriendFragment.java
| ... | ... | @@ -16,6 +16,11 @@ import com.cnlive.strike.xiaojiaspeaker.R; |
| 16 | 16 | import com.cnlive.strike.xiaojiaspeaker.databinding.FragmentSelectImFriendBinding; |
| 17 | 17 | import com.cnlive.strike.xiaojiaspeaker.frame.presenter.SelectIMFriendPresenter; |
| 18 | 18 | import com.cnlive.strike.xiaojiaspeaker.frame.view.SelectIMFriendView; |
| 19 | +import com.cnlive.strike.xiaojiaspeaker.model.message.EventMsg; | |
| 20 | +import com.cnlive.strike.xiaojiaspeaker.util.EventBusUtil; | |
| 21 | + | |
| 22 | +import org.greenrobot.eventbus.Subscribe; | |
| 23 | +import org.greenrobot.eventbus.ThreadMode; | |
| 19 | 24 | |
| 20 | 25 | import java.util.List; |
| 21 | 26 | |
| ... | ... | @@ -44,6 +49,7 @@ public class SelectIMFriendFragment extends MvpBindingFragment<SelectIMFriendVie |
| 44 | 49 | @Override |
| 45 | 50 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
| 46 | 51 | super.onViewCreated(view, savedInstanceState); |
| 52 | + EventBusUtil.register(this); | |
| 47 | 53 | initTopBar(); |
| 48 | 54 | if (null != getMvpView()) { |
| 49 | 55 | if (null != getArguments()) { |
| ... | ... | @@ -58,6 +64,12 @@ public class SelectIMFriendFragment extends MvpBindingFragment<SelectIMFriendVie |
| 58 | 64 | } |
| 59 | 65 | } |
| 60 | 66 | |
| 67 | + @Override | |
| 68 | + public void onDestroy() { | |
| 69 | + super.onDestroy(); | |
| 70 | + EventBusUtil.unRegister(this); | |
| 71 | + | |
| 72 | + } | |
| 61 | 73 | |
| 62 | 74 | private void initTopBar() { |
| 63 | 75 | |
| ... | ... | @@ -74,4 +86,13 @@ public class SelectIMFriendFragment extends MvpBindingFragment<SelectIMFriendVie |
| 74 | 86 | }); |
| 75 | 87 | } |
| 76 | 88 | } |
| 89 | + | |
| 90 | + @Subscribe(threadMode = ThreadMode.MAIN) | |
| 91 | + public void event(EventMsg msg) { | |
| 92 | + if (EventMsg.INVIT_FRIEND_SUCCESS == msg.getEventType()) { | |
| 93 | + if (null != getMvpView()) { | |
| 94 | + getActivity().finish(); | |
| 95 | + } | |
| 96 | + } | |
| 97 | + } | |
| 77 | 98 | } | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/fragment/SetFriendsRoleFragment.java
| ... | ... | @@ -13,6 +13,11 @@ import com.cnlive.strike.xiaojiaspeaker.commonInfo.XiaoJIaCommInfo; |
| 13 | 13 | import com.cnlive.strike.xiaojiaspeaker.databinding.FragmentSetFriendRoleBinding; |
| 14 | 14 | import com.cnlive.strike.xiaojiaspeaker.frame.presenter.SetFriendsRolePresenter; |
| 15 | 15 | import com.cnlive.strike.xiaojiaspeaker.frame.view.SetFriendsRoleView; |
| 16 | +import com.cnlive.strike.xiaojiaspeaker.model.message.EventMsg; | |
| 17 | +import com.cnlive.strike.xiaojiaspeaker.util.EventBusUtil; | |
| 18 | + | |
| 19 | +import org.greenrobot.eventbus.Subscribe; | |
| 20 | +import org.greenrobot.eventbus.ThreadMode; | |
| 16 | 21 | |
| 17 | 22 | /** |
| 18 | 23 | * 设置角色关系 |
| ... | ... | @@ -44,6 +49,7 @@ public class SetFriendsRoleFragment extends MvpBindingFragment<SetFriendsRoleVie |
| 44 | 49 | @Override |
| 45 | 50 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
| 46 | 51 | super.onViewCreated(view, savedInstanceState); |
| 52 | + EventBusUtil.register(this); | |
| 47 | 53 | initTopBar(); |
| 48 | 54 | if (null != getArguments()) { |
| 49 | 55 | selectUid = getArguments().getString("selectUid"); |
| ... | ... | @@ -71,4 +77,19 @@ public class SetFriendsRoleFragment extends MvpBindingFragment<SetFriendsRoleVie |
| 71 | 77 | }); |
| 72 | 78 | } |
| 73 | 79 | } |
| 80 | + | |
| 81 | + @Override | |
| 82 | + public void onDestroy() { | |
| 83 | + super.onDestroy(); | |
| 84 | + EventBusUtil.unRegister(this); | |
| 85 | + } | |
| 86 | + | |
| 87 | + @Subscribe(threadMode = ThreadMode.MAIN) | |
| 88 | + public void event(EventMsg msg) { | |
| 89 | + if (EventMsg.INVIT_FRIEND_SUCCESS == msg.getEventType()) { | |
| 90 | + if (null != getMvpView()) { | |
| 91 | + getActivity().finish(); | |
| 92 | + } | |
| 93 | + } | |
| 94 | + } | |
| 74 | 95 | } | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/fragment/UserManagerFragment.java
| ... | ... | @@ -3,6 +3,7 @@ package com.cnlive.strike.xiaojiaspeaker.ui.fragment; |
| 3 | 3 | import android.os.Bundle; |
| 4 | 4 | import android.support.annotation.Nullable; |
| 5 | 5 | import android.support.v4.content.ContextCompat; |
| 6 | +import android.text.TextUtils; | |
| 6 | 7 | import android.view.View; |
| 7 | 8 | import android.widget.Button; |
| 8 | 9 | |
| ... | ... | @@ -14,12 +15,18 @@ import com.cnlive.strike.xiaojiaspeaker.commonInfo.XiaoJIaCommInfo; |
| 14 | 15 | import com.cnlive.strike.xiaojiaspeaker.databinding.FragmentUserManagerBinding; |
| 15 | 16 | import com.cnlive.strike.xiaojiaspeaker.frame.presenter.UserManagerPresenter; |
| 16 | 17 | import com.cnlive.strike.xiaojiaspeaker.frame.view.UserManagerView; |
| 18 | +import com.cnlive.strike.xiaojiaspeaker.model.message.EventMsg; | |
| 19 | +import com.cnlive.strike.xiaojiaspeaker.util.EventBusUtil; | |
| 20 | + | |
| 21 | +import org.greenrobot.eventbus.Subscribe; | |
| 22 | +import org.greenrobot.eventbus.ThreadMode; | |
| 17 | 23 | |
| 18 | 24 | /** |
| 19 | 25 | * 使用者管理 |
| 20 | 26 | */ |
| 21 | 27 | public class UserManagerFragment extends MvpBindingFragment<UserManagerView, UserManagerPresenter, Object, FragmentUserManagerBinding> { |
| 22 | 28 | |
| 29 | + private String currentSelectFamilyId; | |
| 23 | 30 | |
| 24 | 31 | public static UserManagerFragment newInstance(String currentSelectFamilyId) { |
| 25 | 32 | UserManagerFragment fragment = new UserManagerFragment(); |
| ... | ... | @@ -44,9 +51,10 @@ public class UserManagerFragment extends MvpBindingFragment<UserManagerView, Use |
| 44 | 51 | @Override |
| 45 | 52 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
| 46 | 53 | super.onViewCreated(view, savedInstanceState); |
| 54 | + EventBusUtil.register(this); | |
| 47 | 55 | initTopBar(); |
| 48 | 56 | if (null != getArguments()) { |
| 49 | - String currentSelectFamilyId = getArguments().getString("currentSelectFamilyId"); | |
| 57 | + currentSelectFamilyId = getArguments().getString("currentSelectFamilyId"); | |
| 50 | 58 | if (null != getMvpView()) { |
| 51 | 59 | if (null != currentSelectFamilyId) { |
| 52 | 60 | getMvpView().setCurrentSelectFamily(currentSelectFamilyId); |
| ... | ... | @@ -59,6 +67,13 @@ public class UserManagerFragment extends MvpBindingFragment<UserManagerView, Use |
| 59 | 67 | |
| 60 | 68 | } |
| 61 | 69 | |
| 70 | + @Override | |
| 71 | + public void onDestroy() { | |
| 72 | + super.onDestroy(); | |
| 73 | + EventBusUtil.unRegister(this); | |
| 74 | + | |
| 75 | + } | |
| 76 | + | |
| 62 | 77 | private void initTopBar() { |
| 63 | 78 | if (null != binding) { |
| 64 | 79 | binding.topbar.setTitle("使用者管理").setTextColor(ContextCompat.getColor(getActivity(), R.color.color_282828)); |
| ... | ... | @@ -74,4 +89,15 @@ public class UserManagerFragment extends MvpBindingFragment<UserManagerView, Use |
| 74 | 89 | |
| 75 | 90 | } |
| 76 | 91 | } |
| 92 | + | |
| 93 | + @Subscribe(threadMode = ThreadMode.MAIN) | |
| 94 | + public void event(EventMsg msg) { | |
| 95 | + if (EventMsg.INVIT_FRIEND_SUCCESS == msg.getEventType()) { | |
| 96 | + if (null != getMvpView()) { | |
| 97 | + if (!TextUtils.isEmpty(currentSelectFamilyId)) { | |
| 98 | + getPresenter().getFamilyRole(getActivity(), XiaoJIaCommInfo.getUserId(getActivity()), currentSelectFamilyId, XiaoJIaCommInfo.getUserPhone(getActivity())); | |
| 99 | + } | |
| 100 | + } | |
| 101 | + } | |
| 102 | + } | |
| 77 | 103 | } | ... | ... |