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 +13,13 @@ public class MyApp extends Application { | ||
| 13 | super.onCreate(); | 13 | super.onCreate(); |
| 14 | initARouter(); | 14 | initARouter(); |
| 15 | String userId = ""; | 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,6 +9,7 @@ import com.cnlive.libs.base.logic.Logic; | ||
| 9 | import com.cnlive.libs.base.logic.callback.DataCallback; | 9 | import com.cnlive.libs.base.logic.callback.DataCallback; |
| 10 | import com.cnlive.libs.base.logic.callback.FailureCallback; | 10 | import com.cnlive.libs.base.logic.callback.FailureCallback; |
| 11 | import com.cnlive.libs.base.logic.callback.SuccessCallback; | 11 | import com.cnlive.libs.base.logic.callback.SuccessCallback; |
| 12 | +import com.cnlive.libs.base.util.AlertUtil; | ||
| 12 | import com.cnlive.strike.xiaojiaspeaker.frame.view.ChangeDeviceNameView; | 13 | import com.cnlive.strike.xiaojiaspeaker.frame.view.ChangeDeviceNameView; |
| 13 | import com.cnlive.strike.xiaojiaspeaker.model.message.EventMsg; | 14 | import com.cnlive.strike.xiaojiaspeaker.model.message.EventMsg; |
| 14 | import com.cnlive.strike.xiaojiaspeaker.netWork.ApiServiceXiaoJia; | 15 | import com.cnlive.strike.xiaojiaspeaker.netWork.ApiServiceXiaoJia; |
| @@ -54,18 +55,8 @@ public class ChangeDeviceNamePresenter extends MvpBasePresenter<ChangeDeviceName | @@ -54,18 +55,8 @@ public class ChangeDeviceNamePresenter extends MvpBasePresenter<ChangeDeviceName | ||
| 54 | } | 55 | } |
| 55 | EventBus.getDefault().post(new EventMsg(EventMsg.CHANGE_DEVICE_NAME_SUCCESS, newName)); | 56 | EventBus.getDefault().post(new EventMsg(EventMsg.CHANGE_DEVICE_NAME_SUCCESS, newName)); |
| 56 | QMUITipDialogUtil.dismessDialog(); | 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 | .setFailureCallback(new FailureCallback() { | 62 | .setFailureCallback(new FailureCallback() { |
| @@ -77,7 +68,7 @@ public class ChangeDeviceNamePresenter extends MvpBasePresenter<ChangeDeviceName | @@ -77,7 +68,7 @@ public class ChangeDeviceNamePresenter extends MvpBasePresenter<ChangeDeviceName | ||
| 77 | return; | 68 | return; |
| 78 | } | 69 | } |
| 79 | QMUITipDialogUtil.dismessDialog(); | 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,6 +7,7 @@ import com.cnlive.libs.base.logic.Logic; | ||
| 7 | import com.cnlive.libs.base.logic.callback.DataCallback; | 7 | import com.cnlive.libs.base.logic.callback.DataCallback; |
| 8 | import com.cnlive.libs.base.logic.callback.FailureCallback; | 8 | import com.cnlive.libs.base.logic.callback.FailureCallback; |
| 9 | import com.cnlive.libs.base.logic.callback.SuccessCallback; | 9 | import com.cnlive.libs.base.logic.callback.SuccessCallback; |
| 10 | +import com.cnlive.libs.base.util.AlertUtil; | ||
| 10 | import com.cnlive.strike.xiaojiaspeaker.frame.view.ChangeWifiFragmentView; | 11 | import com.cnlive.strike.xiaojiaspeaker.frame.view.ChangeWifiFragmentView; |
| 11 | import com.cnlive.strike.xiaojiaspeaker.frame.view.SelectWifiFragmentView; | 12 | import com.cnlive.strike.xiaojiaspeaker.frame.view.SelectWifiFragmentView; |
| 12 | import com.cnlive.strike.xiaojiaspeaker.model.message.EventMsg; | 13 | import com.cnlive.strike.xiaojiaspeaker.model.message.EventMsg; |
| @@ -52,7 +53,7 @@ public class ChangeWifiFragmentPresenter extends MvpBasePresenter<ChangeWifiFrag | @@ -52,7 +53,7 @@ public class ChangeWifiFragmentPresenter extends MvpBasePresenter<ChangeWifiFrag | ||
| 52 | return; | 53 | return; |
| 53 | } | 54 | } |
| 54 | QMUITipDialogUtil.dismessDialog(); | 55 | QMUITipDialogUtil.dismessDialog(); |
| 55 | - QMUITipDialogUtil.successDialog(context, baseInfo.getMessage(), 1); | 56 | + AlertUtil.showDeftToast(context,baseInfo.getMessage()); |
| 56 | Log.e(TAG, "onSuccess: " + baseInfo.getMessage()); | 57 | Log.e(TAG, "onSuccess: " + baseInfo.getMessage()); |
| 57 | if (null != onResponseListener) { | 58 | if (null != onResponseListener) { |
| 58 | onResponseListener.onSuccess(); | 59 | onResponseListener.onSuccess(); |
| @@ -68,7 +69,7 @@ public class ChangeWifiFragmentPresenter extends MvpBasePresenter<ChangeWifiFrag | @@ -68,7 +69,7 @@ public class ChangeWifiFragmentPresenter extends MvpBasePresenter<ChangeWifiFrag | ||
| 68 | return; | 69 | return; |
| 69 | } | 70 | } |
| 70 | QMUITipDialogUtil.dismessDialog(); | 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,6 +7,7 @@ import com.cnlive.libs.base.logic.Logic; | ||
| 7 | import com.cnlive.libs.base.logic.callback.DataCallback; | 7 | import com.cnlive.libs.base.logic.callback.DataCallback; |
| 8 | import com.cnlive.libs.base.logic.callback.FailureCallback; | 8 | import com.cnlive.libs.base.logic.callback.FailureCallback; |
| 9 | import com.cnlive.libs.base.logic.callback.SuccessCallback; | 9 | import com.cnlive.libs.base.logic.callback.SuccessCallback; |
| 10 | +import com.cnlive.libs.base.util.AlertUtil; | ||
| 10 | import com.cnlive.strike.xiaojiaspeaker.frame.view.DeviceManagerFragmentView; | 11 | import com.cnlive.strike.xiaojiaspeaker.frame.view.DeviceManagerFragmentView; |
| 11 | import com.cnlive.strike.xiaojiaspeaker.model.message.EventMsg; | 12 | import com.cnlive.strike.xiaojiaspeaker.model.message.EventMsg; |
| 12 | import com.cnlive.strike.xiaojiaspeaker.netWork.ApiServiceXiaoJia; | 13 | import com.cnlive.strike.xiaojiaspeaker.netWork.ApiServiceXiaoJia; |
| @@ -18,6 +19,7 @@ import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; | @@ -18,6 +19,7 @@ import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; | ||
| 18 | 19 | ||
| 19 | import org.greenrobot.eventbus.EventBus; | 20 | import org.greenrobot.eventbus.EventBus; |
| 20 | 21 | ||
| 22 | +import java.util.ArrayList; | ||
| 21 | import java.util.HashMap; | 23 | import java.util.HashMap; |
| 22 | import java.util.Map; | 24 | import java.util.Map; |
| 23 | 25 | ||
| @@ -57,7 +59,7 @@ public class DeviceManagerFragmentPresenter extends MvpBasePresenter<DeviceManag | @@ -57,7 +59,7 @@ public class DeviceManagerFragmentPresenter extends MvpBasePresenter<DeviceManag | ||
| 57 | return; | 59 | return; |
| 58 | } | 60 | } |
| 59 | QMUITipDialogUtil.dismessDialog(); | 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,6 +2,7 @@ package com.cnlive.strike.xiaojiaspeaker.frame.presenter; | ||
| 2 | 2 | ||
| 3 | import android.app.Activity; | 3 | import android.app.Activity; |
| 4 | import android.content.Context; | 4 | import android.content.Context; |
| 5 | +import android.os.Handler; | ||
| 5 | import android.util.Log; | 6 | import android.util.Log; |
| 6 | import android.view.View; | 7 | import android.view.View; |
| 7 | 8 | ||
| @@ -9,7 +10,9 @@ import com.cnlive.libs.base.logic.Logic; | @@ -9,7 +10,9 @@ import com.cnlive.libs.base.logic.Logic; | ||
| 9 | import com.cnlive.libs.base.logic.callback.DataCallback; | 10 | import com.cnlive.libs.base.logic.callback.DataCallback; |
| 10 | import com.cnlive.libs.base.logic.callback.FailureCallback; | 11 | import com.cnlive.libs.base.logic.callback.FailureCallback; |
| 11 | import com.cnlive.libs.base.logic.callback.SuccessCallback; | 12 | import com.cnlive.libs.base.logic.callback.SuccessCallback; |
| 13 | +import com.cnlive.libs.base.util.AlertUtil; | ||
| 12 | import com.cnlive.strike.xiaojiaspeaker.frame.view.SetFriendsRoleView; | 14 | import com.cnlive.strike.xiaojiaspeaker.frame.view.SetFriendsRoleView; |
| 15 | +import com.cnlive.strike.xiaojiaspeaker.model.message.EventMsg; | ||
| 13 | import com.cnlive.strike.xiaojiaspeaker.netWork.ApiServiceCMCC; | 16 | import com.cnlive.strike.xiaojiaspeaker.netWork.ApiServiceCMCC; |
| 14 | import com.cnlive.strike.xiaojiaspeaker.netWork.ApiServiceXiaoJia; | 17 | import com.cnlive.strike.xiaojiaspeaker.netWork.ApiServiceXiaoJia; |
| 15 | import com.cnlive.strike.xiaojiaspeaker.netWork.CmccRequest; | 18 | import com.cnlive.strike.xiaojiaspeaker.netWork.CmccRequest; |
| @@ -22,6 +25,8 @@ import com.cnlive.strike.xiaojiaspeaker.util.QMUITipDialogUtil; | @@ -22,6 +25,8 @@ import com.cnlive.strike.xiaojiaspeaker.util.QMUITipDialogUtil; | ||
| 22 | import com.cnlive.strike.xiaojiaspeaker.util.subutil.util.http.Request; | 25 | import com.cnlive.strike.xiaojiaspeaker.util.subutil.util.http.Request; |
| 23 | import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; | 26 | import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; |
| 24 | 27 | ||
| 28 | +import org.greenrobot.eventbus.EventBus; | ||
| 29 | + | ||
| 25 | import java.util.HashMap; | 30 | import java.util.HashMap; |
| 26 | import java.util.Map; | 31 | import java.util.Map; |
| 27 | 32 | ||
| @@ -38,11 +43,11 @@ public class SetFriendsRolePresenter extends MvpBasePresenter<SetFriendsRoleView | @@ -38,11 +43,11 @@ public class SetFriendsRolePresenter extends MvpBasePresenter<SetFriendsRoleView | ||
| 38 | 43 | ||
| 39 | 44 | ||
| 40 | public void queryConfigDeviceNetResult(Activity context, String contactsInvite) { | 45 | public void queryConfigDeviceNetResult(Activity context, String contactsInvite) { |
| 41 | - InvitFamilyBean1 bean1=new InvitFamilyBean1(); | 46 | + InvitFamilyBean1 bean1 = new InvitFamilyBean1(); |
| 42 | bean1.setType("2"); | 47 | bean1.setType("2"); |
| 43 | bean1.setContactsInvite(GsonUtil.jsonToList(contactsInvite, InvitFamilyBean1.ContactsInviteBean.class)); | 48 | bean1.setContactsInvite(GsonUtil.jsonToList(contactsInvite, InvitFamilyBean1.ContactsInviteBean.class)); |
| 44 | 49 | ||
| 45 | - CmccRequest.getInstance(context,ApiServiceCMCC.class) | 50 | + CmccRequest.getInstance(context, ApiServiceCMCC.class) |
| 46 | .invitFamilyMember(bean1) | 51 | .invitFamilyMember(bean1) |
| 47 | .enqueue(new Callback<APIBaseInfo>() { | 52 | .enqueue(new Callback<APIBaseInfo>() { |
| 48 | @Override | 53 | @Override |
| @@ -80,12 +85,12 @@ public class SetFriendsRolePresenter extends MvpBasePresenter<SetFriendsRoleView | @@ -80,12 +85,12 @@ public class SetFriendsRolePresenter extends MvpBasePresenter<SetFriendsRoleView | ||
| 80 | } | 85 | } |
| 81 | QMUITipDialogUtil.loadingDialog(context, "请稍后", true); | 86 | QMUITipDialogUtil.loadingDialog(context, "请稍后", true); |
| 82 | Map<String, String> map = new HashMap<>(); | 87 | Map<String, String> map = new HashMap<>(); |
| 83 | - map.put("type","2");//联系人邀请 | 88 | + map.put("type", "2");//联系人邀请 |
| 84 | map.put("contactsInvite", contactsInvite); | 89 | map.put("contactsInvite", contactsInvite); |
| 85 | Logic.create(map) | 90 | Logic.create(map) |
| 86 | - .action(new Logic.Action< Map<String, String> , APIBaseInfo>() { | 91 | + .action(new Logic.Action<Map<String, String>, APIBaseInfo>() { |
| 87 | @Override | 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 | return SubscriptionRequest.service(ApiServiceXiaoJia.class, api -> api.invitFamilyMember(map)).subscribe(context, dataCallback); | 94 | return SubscriptionRequest.service(ApiServiceXiaoJia.class, api -> api.invitFamilyMember(map)).subscribe(context, dataCallback); |
| 90 | } | 95 | } |
| 91 | }).<APIBaseInfo>event() | 96 | }).<APIBaseInfo>event() |
| @@ -98,7 +103,8 @@ public class SetFriendsRolePresenter extends MvpBasePresenter<SetFriendsRoleView | @@ -98,7 +103,8 @@ public class SetFriendsRolePresenter extends MvpBasePresenter<SetFriendsRoleView | ||
| 98 | return; | 103 | return; |
| 99 | } | 104 | } |
| 100 | QMUITipDialogUtil.dismessDialog(); | 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 | .setFailureCallback(new FailureCallback() { | 110 | .setFailureCallback(new FailureCallback() { |
| @@ -110,7 +116,7 @@ public class SetFriendsRolePresenter extends MvpBasePresenter<SetFriendsRoleView | @@ -110,7 +116,7 @@ public class SetFriendsRolePresenter extends MvpBasePresenter<SetFriendsRoleView | ||
| 110 | return; | 116 | return; |
| 111 | } | 117 | } |
| 112 | QMUITipDialogUtil.dismessDialog(); | 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,4 +175,8 @@ public class SetFriendsRolePresenter extends MvpBasePresenter<SetFriendsRoleView | ||
| 169 | 175 | ||
| 170 | .start(); | 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,6 +9,7 @@ import com.cnlive.libs.base.logic.Logic; | ||
| 9 | import com.cnlive.libs.base.logic.callback.DataCallback; | 9 | import com.cnlive.libs.base.logic.callback.DataCallback; |
| 10 | import com.cnlive.libs.base.logic.callback.FailureCallback; | 10 | import com.cnlive.libs.base.logic.callback.FailureCallback; |
| 11 | import com.cnlive.libs.base.logic.callback.SuccessCallback; | 11 | import com.cnlive.libs.base.logic.callback.SuccessCallback; |
| 12 | +import com.cnlive.libs.base.util.AlertUtil; | ||
| 12 | import com.cnlive.strike.xiaojiaspeaker.frame.view.UserManagerView; | 13 | import com.cnlive.strike.xiaojiaspeaker.frame.view.UserManagerView; |
| 13 | import com.cnlive.strike.xiaojiaspeaker.netWork.ApiServiceXiaoJia; | 14 | import com.cnlive.strike.xiaojiaspeaker.netWork.ApiServiceXiaoJia; |
| 14 | import com.cnlive.strike.xiaojiaspeaker.netWork.bean.FamilyRoleBean; | 15 | import com.cnlive.strike.xiaojiaspeaker.netWork.bean.FamilyRoleBean; |
| @@ -76,7 +77,7 @@ public class UserManagerPresenter extends MvpBasePresenter<UserManagerView> { | @@ -76,7 +77,7 @@ public class UserManagerPresenter extends MvpBasePresenter<UserManagerView> { | ||
| 76 | return; | 77 | return; |
| 77 | } | 78 | } |
| 78 | QMUITipDialogUtil.dismessDialog(); | 79 | QMUITipDialogUtil.dismessDialog(); |
| 79 | - QMUITipDialogUtil.failedDialog(context, s, 1); | 80 | + AlertUtil.showDeftToast(context,s); |
| 80 | //显示重试 | 81 | //显示重试 |
| 81 | Log.e(TAG, "onFailure: " + s); | 82 | Log.e(TAG, "onFailure: " + s); |
| 82 | } | 83 | } |
| @@ -175,7 +176,7 @@ public class UserManagerPresenter extends MvpBasePresenter<UserManagerView> { | @@ -175,7 +176,7 @@ public class UserManagerPresenter extends MvpBasePresenter<UserManagerView> { | ||
| 175 | } | 176 | } |
| 176 | //显示重试 | 177 | //显示重试 |
| 177 | QMUITipDialogUtil.dismessDialog(); | 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,7 +65,7 @@ public class SelectWifiFragmentView implements MvpView { | ||
| 65 | if (isSetNetSuccess) { | 65 | if (isSetNetSuccess) { |
| 66 | if (null != getContext()) { | 66 | if (null != getContext()) { |
| 67 | QMUITipDialogUtil.dismessDialog(); | 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,7 +212,7 @@ public class SelectWifiFragmentView implements MvpView { | ||
| 212 | // 连接失败 | 212 | // 连接失败 |
| 213 | @Override | 213 | @Override |
| 214 | public void onConnectFail(BleDevice bleDevice, BleException exception) { | 214 | public void onConnectFail(BleDevice bleDevice, BleException exception) { |
| 215 | - QMUITipDialogUtil.failedDialog(getContext(), "连接失败,请重试...", 2); | 215 | + AlertUtil.showDeftToast(getContext(), "连接失败,请重试..."); |
| 216 | Log.e(TAG, "onConnectFail: " + exception); | 216 | Log.e(TAG, "onConnectFail: " + exception); |
| 217 | } | 217 | } |
| 218 | 218 | ||
| @@ -247,7 +247,7 @@ public class SelectWifiFragmentView implements MvpView { | @@ -247,7 +247,7 @@ public class SelectWifiFragmentView implements MvpView { | ||
| 247 | @Override | 247 | @Override |
| 248 | public void onWriteFailure(BleException exception) { | 248 | public void onWriteFailure(BleException exception) { |
| 249 | Log.e(TAG, "onWriteFailure: "); | 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,8 +257,7 @@ public class SelectWifiFragmentView implements MvpView { | ||
| 257 | @Override | 257 | @Override |
| 258 | public void onNotifyFailure(BleException exception) { | 258 | public void onNotifyFailure(BleException exception) { |
| 259 | Log.e(TAG, "onNotifyFailure: " + exception); | 259 | Log.e(TAG, "onNotifyFailure: " + exception); |
| 260 | - QMUITipDialogUtil.failedDialog(getContext(), "连接失败,请重试...", 2); | ||
| 261 | - | 260 | + AlertUtil.showDeftToast(getContext(), "连接失败,请重试..."); |
| 262 | } | 261 | } |
| 263 | 262 | ||
| 264 | @Override | 263 | @Override |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/view/SetFriendsRoleView.java
| @@ -9,6 +9,7 @@ import android.view.View; | @@ -9,6 +9,7 @@ import android.view.View; | ||
| 9 | 9 | ||
| 10 | import com.cnlive.libs.base.util.AlertUtil; | 10 | import com.cnlive.libs.base.util.AlertUtil; |
| 11 | import com.cnlive.strike.xiaojiaspeaker.R; | 11 | import com.cnlive.strike.xiaojiaspeaker.R; |
| 12 | +import com.cnlive.strike.xiaojiaspeaker.frame.presenter.SetFriendsRolePresenter; | ||
| 12 | import com.cnlive.strike.xiaojiaspeaker.model.RoleInfo; | 13 | import com.cnlive.strike.xiaojiaspeaker.model.RoleInfo; |
| 13 | import com.cnlive.strike.xiaojiaspeaker.netWork.bean.RoleNetBean; | 14 | import com.cnlive.strike.xiaojiaspeaker.netWork.bean.RoleNetBean; |
| 14 | import com.cnlive.strike.xiaojiaspeaker.ui.adapter.SetRoleAdapter; | 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,7 +190,7 @@ public class UserManagerView implements MvpView { | ||
| 190 | } | 190 | } |
| 191 | 191 | ||
| 192 | public void addAdminBtn() { | 192 | public void addAdminBtn() { |
| 193 | - //添加邀请者按钮 | 193 | + fragment.binding.topbar.removeAllRightViews(); //添加邀请者按钮 |
| 194 | btn_invit = fragment.binding.topbar.addRightTextButton("邀请使用者", R.id.rightBtn); | 194 | btn_invit = fragment.binding.topbar.addRightTextButton("邀请使用者", R.id.rightBtn); |
| 195 | btn_invit.setTextSize(15); | 195 | btn_invit.setTextSize(15); |
| 196 | btn_invit.setTextColor(ContextCompat.getColor(getContext(), R.color.color_282828)); | 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,7 +3,8 @@ package com.cnlive.strike.xiaojiaspeaker.model.message; | ||
| 3 | public class EventMsg { | 3 | public class EventMsg { |
| 4 | public static final int CHANGE_DEVICE_NAME_SUCCESS = 0;//修改时设备名称成功 | 4 | public static final int CHANGE_DEVICE_NAME_SUCCESS = 0;//修改时设备名称成功 |
| 5 | public static final int DELETE_DEVICE_NAME_SUCCESS = 1;//删除设备成功 | 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 | private int eventType; | 9 | private int eventType; |
| 9 | private Object data; | 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,6 +15,7 @@ import com.cnlive.libs.base.logic.Logic; | ||
| 15 | import com.cnlive.libs.base.logic.callback.DataCallback; | 15 | import com.cnlive.libs.base.logic.callback.DataCallback; |
| 16 | import com.cnlive.libs.base.logic.callback.FailureCallback; | 16 | import com.cnlive.libs.base.logic.callback.FailureCallback; |
| 17 | import com.cnlive.libs.base.logic.callback.SuccessCallback; | 17 | import com.cnlive.libs.base.logic.callback.SuccessCallback; |
| 18 | +import com.cnlive.libs.base.util.AlertUtil; | ||
| 18 | import com.cnlive.libs.base.util.StatusBarUtil; | 19 | import com.cnlive.libs.base.util.StatusBarUtil; |
| 19 | import com.cnlive.libs.base.util.StatusBarUtil2; | 20 | import com.cnlive.libs.base.util.StatusBarUtil2; |
| 20 | import com.cnlive.strike.xiaojiaspeaker.R; | 21 | import com.cnlive.strike.xiaojiaspeaker.R; |
| @@ -215,7 +216,7 @@ public class RemoteControlActivity extends AppCompatActivity { | @@ -215,7 +216,7 @@ public class RemoteControlActivity extends AppCompatActivity { | ||
| 215 | setRemoteBtnState(false); | 216 | setRemoteBtnState(false); |
| 216 | //显示重试 | 217 | //显示重试 |
| 217 | QMUITipDialogUtil.dismessDialog(); | 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,6 +16,11 @@ import com.cnlive.strike.xiaojiaspeaker.R; | ||
| 16 | import com.cnlive.strike.xiaojiaspeaker.databinding.FragmentSelectImFriendBinding; | 16 | import com.cnlive.strike.xiaojiaspeaker.databinding.FragmentSelectImFriendBinding; |
| 17 | import com.cnlive.strike.xiaojiaspeaker.frame.presenter.SelectIMFriendPresenter; | 17 | import com.cnlive.strike.xiaojiaspeaker.frame.presenter.SelectIMFriendPresenter; |
| 18 | import com.cnlive.strike.xiaojiaspeaker.frame.view.SelectIMFriendView; | 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 | import java.util.List; | 25 | import java.util.List; |
| 21 | 26 | ||
| @@ -44,6 +49,7 @@ public class SelectIMFriendFragment extends MvpBindingFragment<SelectIMFriendVie | @@ -44,6 +49,7 @@ public class SelectIMFriendFragment extends MvpBindingFragment<SelectIMFriendVie | ||
| 44 | @Override | 49 | @Override |
| 45 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | 50 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
| 46 | super.onViewCreated(view, savedInstanceState); | 51 | super.onViewCreated(view, savedInstanceState); |
| 52 | + EventBusUtil.register(this); | ||
| 47 | initTopBar(); | 53 | initTopBar(); |
| 48 | if (null != getMvpView()) { | 54 | if (null != getMvpView()) { |
| 49 | if (null != getArguments()) { | 55 | if (null != getArguments()) { |
| @@ -58,6 +64,12 @@ public class SelectIMFriendFragment extends MvpBindingFragment<SelectIMFriendVie | @@ -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 | private void initTopBar() { | 74 | private void initTopBar() { |
| 63 | 75 | ||
| @@ -74,4 +86,13 @@ public class SelectIMFriendFragment extends MvpBindingFragment<SelectIMFriendVie | @@ -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,6 +13,11 @@ import com.cnlive.strike.xiaojiaspeaker.commonInfo.XiaoJIaCommInfo; | ||
| 13 | import com.cnlive.strike.xiaojiaspeaker.databinding.FragmentSetFriendRoleBinding; | 13 | import com.cnlive.strike.xiaojiaspeaker.databinding.FragmentSetFriendRoleBinding; |
| 14 | import com.cnlive.strike.xiaojiaspeaker.frame.presenter.SetFriendsRolePresenter; | 14 | import com.cnlive.strike.xiaojiaspeaker.frame.presenter.SetFriendsRolePresenter; |
| 15 | import com.cnlive.strike.xiaojiaspeaker.frame.view.SetFriendsRoleView; | 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,6 +49,7 @@ public class SetFriendsRoleFragment extends MvpBindingFragment<SetFriendsRoleVie | ||
| 44 | @Override | 49 | @Override |
| 45 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | 50 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
| 46 | super.onViewCreated(view, savedInstanceState); | 51 | super.onViewCreated(view, savedInstanceState); |
| 52 | + EventBusUtil.register(this); | ||
| 47 | initTopBar(); | 53 | initTopBar(); |
| 48 | if (null != getArguments()) { | 54 | if (null != getArguments()) { |
| 49 | selectUid = getArguments().getString("selectUid"); | 55 | selectUid = getArguments().getString("selectUid"); |
| @@ -71,4 +77,19 @@ public class SetFriendsRoleFragment extends MvpBindingFragment<SetFriendsRoleVie | @@ -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,6 +3,7 @@ package com.cnlive.strike.xiaojiaspeaker.ui.fragment; | ||
| 3 | import android.os.Bundle; | 3 | import android.os.Bundle; |
| 4 | import android.support.annotation.Nullable; | 4 | import android.support.annotation.Nullable; |
| 5 | import android.support.v4.content.ContextCompat; | 5 | import android.support.v4.content.ContextCompat; |
| 6 | +import android.text.TextUtils; | ||
| 6 | import android.view.View; | 7 | import android.view.View; |
| 7 | import android.widget.Button; | 8 | import android.widget.Button; |
| 8 | 9 | ||
| @@ -14,12 +15,18 @@ import com.cnlive.strike.xiaojiaspeaker.commonInfo.XiaoJIaCommInfo; | @@ -14,12 +15,18 @@ import com.cnlive.strike.xiaojiaspeaker.commonInfo.XiaoJIaCommInfo; | ||
| 14 | import com.cnlive.strike.xiaojiaspeaker.databinding.FragmentUserManagerBinding; | 15 | import com.cnlive.strike.xiaojiaspeaker.databinding.FragmentUserManagerBinding; |
| 15 | import com.cnlive.strike.xiaojiaspeaker.frame.presenter.UserManagerPresenter; | 16 | import com.cnlive.strike.xiaojiaspeaker.frame.presenter.UserManagerPresenter; |
| 16 | import com.cnlive.strike.xiaojiaspeaker.frame.view.UserManagerView; | 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 | public class UserManagerFragment extends MvpBindingFragment<UserManagerView, UserManagerPresenter, Object, FragmentUserManagerBinding> { | 27 | public class UserManagerFragment extends MvpBindingFragment<UserManagerView, UserManagerPresenter, Object, FragmentUserManagerBinding> { |
| 22 | 28 | ||
| 29 | + private String currentSelectFamilyId; | ||
| 23 | 30 | ||
| 24 | public static UserManagerFragment newInstance(String currentSelectFamilyId) { | 31 | public static UserManagerFragment newInstance(String currentSelectFamilyId) { |
| 25 | UserManagerFragment fragment = new UserManagerFragment(); | 32 | UserManagerFragment fragment = new UserManagerFragment(); |
| @@ -44,9 +51,10 @@ public class UserManagerFragment extends MvpBindingFragment<UserManagerView, Use | @@ -44,9 +51,10 @@ public class UserManagerFragment extends MvpBindingFragment<UserManagerView, Use | ||
| 44 | @Override | 51 | @Override |
| 45 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | 52 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
| 46 | super.onViewCreated(view, savedInstanceState); | 53 | super.onViewCreated(view, savedInstanceState); |
| 54 | + EventBusUtil.register(this); | ||
| 47 | initTopBar(); | 55 | initTopBar(); |
| 48 | if (null != getArguments()) { | 56 | if (null != getArguments()) { |
| 49 | - String currentSelectFamilyId = getArguments().getString("currentSelectFamilyId"); | 57 | + currentSelectFamilyId = getArguments().getString("currentSelectFamilyId"); |
| 50 | if (null != getMvpView()) { | 58 | if (null != getMvpView()) { |
| 51 | if (null != currentSelectFamilyId) { | 59 | if (null != currentSelectFamilyId) { |
| 52 | getMvpView().setCurrentSelectFamily(currentSelectFamilyId); | 60 | getMvpView().setCurrentSelectFamily(currentSelectFamilyId); |
| @@ -59,6 +67,13 @@ public class UserManagerFragment extends MvpBindingFragment<UserManagerView, Use | @@ -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 | private void initTopBar() { | 77 | private void initTopBar() { |
| 63 | if (null != binding) { | 78 | if (null != binding) { |
| 64 | binding.topbar.setTitle("使用者管理").setTextColor(ContextCompat.getColor(getActivity(), R.color.color_282828)); | 79 | binding.topbar.setTitle("使用者管理").setTextColor(ContextCompat.getColor(getActivity(), R.color.color_282828)); |
| @@ -74,4 +89,15 @@ public class UserManagerFragment extends MvpBindingFragment<UserManagerView, Use | @@ -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 | } |