Commit 374a9ac4599f8cd166aa629add441153999b2655
1 parent
afee32f4
1 优化配网
Showing
32 changed files
with
631 additions
and
55 deletions
app/src/main/java/com/cnlive/strike/xiaojiaspeaker/MainActivity.java
| ... | ... | @@ -26,16 +26,16 @@ public class MainActivity extends AppCompatActivity { |
| 26 | 26 | protected void onCreate(Bundle savedInstanceState) { |
| 27 | 27 | super.onCreate(savedInstanceState); |
| 28 | 28 | setContentView(R.layout.activity_speaker_main); |
| 29 | - XiaoJIaCommInfo.setUserId(this, "10514333"); | |
| 30 | - XiaoJIaCommInfo.setUserPhone(this, " 18301489586"); | |
| 29 | + XiaoJIaCommInfo.setUserId(this, "10514333".trim()); | |
| 30 | + XiaoJIaCommInfo.setUserPhone(this, "18301489586".trim()); | |
| 31 | 31 | // XiaoJIaCommInfo.setUserId(this, "10513196"); |
| 32 | 32 | // XiaoJIaCommInfo.setUserPhone(this, "15010140838"); |
| 33 | 33 | |
| 34 | 34 | // startActivity(new Intent(MainActivity.this, ToolBarTestActivity.class)); |
| 35 | 35 | // startActivity(new Intent(MainActivity.this, BluetoothConnActivity.class)); |
| 36 | 36 | // startActivity(new Intent(MainActivity.this, BlueToothStep1Activity.class)); |
| 37 | - startActivity(new Intent(MainActivity.this, ConnBluetoothSuccessActivity.class)); | |
| 38 | -// startActivity(new Intent(MainActivity.this, AllDeviceActivity.class)); | |
| 37 | +// startActivity(new Intent(MainActivity.this, ConnBluetoothSuccessActivity.class)); | |
| 38 | + startActivity(new Intent(MainActivity.this, AllDeviceActivity.class)); | |
| 39 | 39 | // startActivity(new Intent(MainActivity.this, DeviceInstructionActivity.class)); |
| 40 | 40 | // startActivity(new Intent(MainActivity.this, DeviceManagerActivity.class)); |
| 41 | 41 | // startActivity(new Intent(MainActivity.this, FirmwareUpdateActivity.class)); | ... | ... |
config.gradle
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/presenter/ChangeDeviceNamePresenter.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 | |
| 7 | 8 | import com.cnlive.libs.base.logic.Logic; |
| ... | ... | @@ -28,7 +29,7 @@ public class ChangeDeviceNamePresenter extends MvpBasePresenter<ChangeDeviceName |
| 28 | 29 | |
| 29 | 30 | private String TAG = "ChangeDeviceNamePresenter"; |
| 30 | 31 | |
| 31 | - public void changeDeviceName(Activity context, String deviceId, String newName) { | |
| 32 | + public void changeDeviceName(Activity context, String deviceId, String newName, OnResponseListener onResponseListener) { | |
| 32 | 33 | if (null == getView()) { |
| 33 | 34 | return; |
| 34 | 35 | } |
| ... | ... | @@ -51,9 +52,20 @@ public class ChangeDeviceNamePresenter extends MvpBasePresenter<ChangeDeviceName |
| 51 | 52 | if (null == getView()) { |
| 52 | 53 | return; |
| 53 | 54 | } |
| 54 | - EventBus.getDefault().post(new EventMsg(EventMsg.CHANGE_DEVICE_NAME_SUCCESS, null)); | |
| 55 | + EventBus.getDefault().post(new EventMsg(EventMsg.CHANGE_DEVICE_NAME_SUCCESS, newName)); | |
| 55 | 56 | QMUITipDialogUtil.dismessDialog(); |
| 56 | 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); | |
| 57 | 69 | } |
| 58 | 70 | }) |
| 59 | 71 | .setFailureCallback(new FailureCallback() { |
| ... | ... | @@ -71,4 +83,8 @@ public class ChangeDeviceNamePresenter extends MvpBasePresenter<ChangeDeviceName |
| 71 | 83 | |
| 72 | 84 | .start(); |
| 73 | 85 | } |
| 86 | + | |
| 87 | + public interface OnResponseListener { | |
| 88 | + void onSuccess(); | |
| 89 | + } | |
| 74 | 90 | } | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/presenter/DeviceManagerFragmentPresenter.java
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/presenter/SelectWifiFragmentPresenter.java
| ... | ... | @@ -8,6 +8,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 | 10 | import com.cnlive.strike.xiaojiaspeaker.frame.view.SelectWifiFragmentView; |
| 11 | +import com.cnlive.strike.xiaojiaspeaker.model.message.EventMsg; | |
| 11 | 12 | import com.cnlive.strike.xiaojiaspeaker.netWork.ApiServiceXiaoJia; |
| 12 | 13 | import com.cnlive.strike.xiaojiaspeaker.netWork.bean.NetworkResultBean; |
| 13 | 14 | import com.cnlive.strike.xiaojiaspeaker.netWork.bean.APIBaseInfo; |
| ... | ... | @@ -15,6 +16,8 @@ import com.cnlive.strike.xiaojiaspeaker.netWork.result.SubscriptionRequest; |
| 15 | 16 | import com.cnlive.strike.xiaojiaspeaker.util.QMUITipDialogUtil; |
| 16 | 17 | import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; |
| 17 | 18 | |
| 19 | +import org.greenrobot.eventbus.EventBus; | |
| 20 | + | |
| 18 | 21 | import java.util.HashMap; |
| 19 | 22 | import java.util.Map; |
| 20 | 23 | |
| ... | ... | @@ -24,7 +27,7 @@ public class SelectWifiFragmentPresenter extends MvpBasePresenter<SelectWifiFrag |
| 24 | 27 | private String TAG = "SelectWifiFragmentPresenter"; |
| 25 | 28 | |
| 26 | 29 | |
| 27 | - public void queryConfigDeviceNetResult(Activity context, String familyId) { | |
| 30 | + public void queryConfigDeviceNetResult(Activity context, String familyId,OnResponseListener onResponseListener) { | |
| 28 | 31 | if (null == getView()) { |
| 29 | 32 | return; |
| 30 | 33 | } |
| ... | ... | @@ -44,15 +47,19 @@ public class SelectWifiFragmentPresenter extends MvpBasePresenter<SelectWifiFrag |
| 44 | 47 | if (null == getView()) { |
| 45 | 48 | return; |
| 46 | 49 | } |
| 50 | + EventBus.getDefault().post(new EventMsg(EventMsg.CLOSE_BLUETOOTH_ACTIVITY,null)); | |
| 47 | 51 | QMUITipDialogUtil.dismessDialog(); |
| 48 | - Log.e(TAG, "onSuccess: "+baseInfo.getMessage()); | |
| 52 | + Log.e(TAG, "onSuccess: " + baseInfo.getMessage()); | |
| 53 | + if (null!=onResponseListener){ | |
| 54 | + onResponseListener.onSuccess(baseInfo.getData()); | |
| 55 | + } | |
| 49 | 56 | } |
| 50 | 57 | }) |
| 51 | 58 | .setFailureCallback(new FailureCallback() { |
| 52 | 59 | @Override |
| 53 | 60 | public void onFailure(int i, String s) { |
| 54 | 61 | //显示重试 |
| 55 | - Log.e(TAG, "onFailure: "+s); | |
| 62 | + Log.e(TAG, "onFailure: " + s); | |
| 56 | 63 | QMUITipDialogUtil.dismessDialog(); |
| 57 | 64 | } |
| 58 | 65 | }) |
| ... | ... | @@ -99,4 +106,8 @@ public class SelectWifiFragmentPresenter extends MvpBasePresenter<SelectWifiFrag |
| 99 | 106 | // } |
| 100 | 107 | // }); |
| 101 | 108 | // } |
| 109 | + | |
| 110 | + public interface OnResponseListener { | |
| 111 | + void onSuccess(NetworkResultBean networkResultBean); | |
| 112 | + } | |
| 102 | 113 | } | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/view/AllDeviceFragmentView.java
| ... | ... | @@ -24,7 +24,7 @@ public class AllDeviceFragmentView implements MvpView { |
| 24 | 24 | private AllDeviceFragment fragment; |
| 25 | 25 | private AllDeviceAdapter adapter; |
| 26 | 26 | private List<FamilyListBean.UsersBeanX.DeviceListBean> allDeviceInfoList; |
| 27 | -// private List<PopMenuInfo> popMenuInfoList = null; | |
| 27 | + // private List<PopMenuInfo> popMenuInfoList = null; | |
| 28 | 28 | // private PopMenu mPopMenu; |
| 29 | 29 | private String TAG = "AllDeviceFragmentView"; |
| 30 | 30 | private FamilyListBean familyListBean; |
| ... | ... | @@ -50,7 +50,7 @@ public class AllDeviceFragmentView implements MvpView { |
| 50 | 50 | for (FamilyListBean.UsersBeanX usersBean : familyListBean.getUsers()) { |
| 51 | 51 | |
| 52 | 52 | //存储自己为主人的家庭 |
| 53 | - if (usersBean.getIsMaster() == FamilyListBean.THE_HOST) { | |
| 53 | + if (FamilyListBean.THE_HOST.equals(usersBean.getIsMaster())) { | |
| 54 | 54 | Log.e(TAG, "getId: " + usersBean.getUserId()); |
| 55 | 55 | Log.e(TAG, "getToken: " + usersBean.getToken()); |
| 56 | 56 | //存储家庭id |
| ... | ... | @@ -83,7 +83,7 @@ public class AllDeviceFragmentView implements MvpView { |
| 83 | 83 | adapter.setOnItemClickListener(new AllDeviceAdapter.OnItemClickListener() { |
| 84 | 84 | @Override |
| 85 | 85 | public void onItemClick(int position, FamilyListBean.UsersBeanX.DeviceListBean AllDeviceInfo) { |
| 86 | - DeviceDetailActivity.startActivity(fragment.getActivity(), AllDeviceInfo,familyListBean.getUsers().get(AllDeviceInfo.getParentPosition()).getId()); | |
| 86 | + DeviceDetailActivity.startActivity(fragment.getActivity(), AllDeviceInfo, familyListBean.getUsers().get(AllDeviceInfo.getParentPosition()).getId()); | |
| 87 | 87 | } |
| 88 | 88 | }); |
| 89 | 89 | } | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/view/ChangeDeviceNameView.java
| ... | ... | @@ -8,6 +8,7 @@ import android.text.TextWatcher; |
| 8 | 8 | import android.view.View; |
| 9 | 9 | |
| 10 | 10 | import com.cnlive.strike.xiaojiaspeaker.R; |
| 11 | +import com.cnlive.strike.xiaojiaspeaker.frame.presenter.ChangeDeviceNamePresenter; | |
| 11 | 12 | import com.cnlive.strike.xiaojiaspeaker.netWork.bean.DeviceDetail; |
| 12 | 13 | import com.cnlive.strike.xiaojiaspeaker.ui.activity.ChangeDeviceNameActivity; |
| 13 | 14 | import com.cnlive.strike.xiaojiaspeaker.ui.fragment.ChangeDeviceNameFragment; |
| ... | ... | @@ -61,7 +62,14 @@ public class ChangeDeviceNameView implements MvpView { |
| 61 | 62 | fragment.binding.btnNext.setOnClickListener(new View.OnClickListener() { |
| 62 | 63 | @Override |
| 63 | 64 | public void onClick(View view) { |
| 64 | - fragment.getPresenter().changeDeviceName(getContext(), deviceId, fragment.binding.etName.getText().toString()); | |
| 65 | + fragment.getPresenter().changeDeviceName(getContext(), deviceId, fragment.binding.etName.getText().toString(), new ChangeDeviceNamePresenter.OnResponseListener() { | |
| 66 | + @Override | |
| 67 | + public void onSuccess() { | |
| 68 | + if (null != getContext()) { | |
| 69 | + getContext().finish(); | |
| 70 | + } | |
| 71 | + } | |
| 72 | + }); | |
| 65 | 73 | } |
| 66 | 74 | }); |
| 67 | 75 | } | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/view/InvitFriendView.java
| ... | ... | @@ -39,7 +39,8 @@ public class InvitFriendView implements MvpView { |
| 39 | 39 | private InvitFriendFragment fragment; |
| 40 | 40 | private List<RoleInfo> roleInfoList; |
| 41 | 41 | private SetRoleAdapter setRoleAdapter; |
| 42 | - private String encryptionContent; | |
| 42 | + private String encryptionContent; | |
| 43 | + private String currentSelectFamilyId; | |
| 43 | 44 | |
| 44 | 45 | public InvitFriendView(InvitFriendFragment fragment) { |
| 45 | 46 | this.fragment = fragment; |
| ... | ... | @@ -49,11 +50,12 @@ public class InvitFriendView implements MvpView { |
| 49 | 50 | return fragment == null ? null : fragment.getActivity(); |
| 50 | 51 | } |
| 51 | 52 | |
| 52 | - public void initView(){ | |
| 53 | + public void initView(String currentSelectFamilyId) { | |
| 54 | + this.currentSelectFamilyId = currentSelectFamilyId; | |
| 53 | 55 | fragment.binding.btnShare.setOnClickListener(v -> { |
| 54 | - if(!TextUtils.isEmpty(encryptionContent)){ | |
| 55 | - ShareFriendActivity.startActivity(fragment.getActivity(),"","",encryptionContent); | |
| 56 | - }else { | |
| 56 | + if (!TextUtils.isEmpty(encryptionContent)) { | |
| 57 | + ShareFriendActivity.startActivity(fragment.getActivity(), "", "", encryptionContent); | |
| 58 | + } else { | |
| 57 | 59 | //提示跳转失败原因 |
| 58 | 60 | } |
| 59 | 61 | }); | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/view/SearchDevicefragmentView.java
| ... | ... | @@ -75,7 +75,7 @@ public class SearchDevicefragmentView implements MvpView { |
| 75 | 75 | fragment.binding.tvPreviousStep.setOnClickListener(new View.OnClickListener() { |
| 76 | 76 | @Override |
| 77 | 77 | public void onClick(View view) { |
| 78 | - BlueToothStep2Activity.startActivity(getContext()); | |
| 78 | +// BlueToothStep2Activity.startActivity(getContext()); | |
| 79 | 79 | fragment.getActivity().finish(); |
| 80 | 80 | } |
| 81 | 81 | }); | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/view/SelectWifiFragmentView.java
| ... | ... | @@ -21,6 +21,9 @@ import com.cnlive.libs.base.util.AlertUtil; |
| 21 | 21 | import com.cnlive.strike.xiaojiaspeaker.R; |
| 22 | 22 | import com.cnlive.strike.xiaojiaspeaker.commonInfo.XiaoJIaCommInfo; |
| 23 | 23 | import com.cnlive.strike.xiaojiaspeaker.constants.BlufiConstants; |
| 24 | +import com.cnlive.strike.xiaojiaspeaker.frame.presenter.SelectWifiFragmentPresenter; | |
| 25 | +import com.cnlive.strike.xiaojiaspeaker.netWork.bean.NetworkResultBean; | |
| 26 | +import com.cnlive.strike.xiaojiaspeaker.ui.activity.ConnBluetoothSuccessActivity; | |
| 24 | 27 | import com.cnlive.strike.xiaojiaspeaker.ui.adapter.WifiRecycleAdapter; |
| 25 | 28 | import com.cnlive.strike.xiaojiaspeaker.ui.fragment.SelectWifiFragment; |
| 26 | 29 | import com.cnlive.strike.xiaojiaspeaker.ui.widget.TipDialog; |
| ... | ... | @@ -48,10 +51,25 @@ public class SelectWifiFragmentView implements MvpView { |
| 48 | 51 | private String familyId; |
| 49 | 52 | private String cmccId;//移动id |
| 50 | 53 | private final int DELAY_TIME = 10;//延时查询10秒 |
| 54 | + private Runnable failRunnable; | |
| 55 | + private boolean isSetNetSuccess = false; | |
| 56 | + private final int FAIL_DELAY_TIME = 40;//配网中等待时间40秒 | |
| 51 | 57 | |
| 52 | 58 | public SelectWifiFragmentView(SelectWifiFragment fragment) { |
| 53 | 59 | this.fragment = fragment; |
| 54 | 60 | wifiUtils = new WifiUtils(fragment.getActivity()); |
| 61 | + failHandler = new Handler(); | |
| 62 | + failRunnable = new Runnable() { | |
| 63 | + @Override | |
| 64 | + public void run() { | |
| 65 | + if (isSetNetSuccess) { | |
| 66 | + if (null != getContext()) { | |
| 67 | + QMUITipDialogUtil.dismessDialog(); | |
| 68 | + QMUITipDialogUtil.failedDialog(getContext(), "配网超时", 1); | |
| 69 | + } | |
| 70 | + } | |
| 71 | + } | |
| 72 | + }; | |
| 55 | 73 | } |
| 56 | 74 | |
| 57 | 75 | public Activity getContext() { |
| ... | ... | @@ -201,6 +219,11 @@ public class SelectWifiFragmentView implements MvpView { |
| 201 | 219 | // 连接成功,BleDevice即为所连接的BLE设备 |
| 202 | 220 | @Override |
| 203 | 221 | public void onConnectSuccess(final BleDevice bleDevice, BluetoothGatt gatt, int status) { |
| 222 | + isSetNetSuccess = false; | |
| 223 | + if (null != failHandler && null != failRunnable) { | |
| 224 | + failHandler.removeCallbacks(failRunnable); | |
| 225 | + failHandler.postDelayed(failRunnable, FAIL_DELAY_TIME * 1000); | |
| 226 | + } | |
| 204 | 227 | BleManager.getInstance().notify( |
| 205 | 228 | bleDevice, |
| 206 | 229 | BlufiConstants.UUID_WIFI_SERVICE.toString(), |
| ... | ... | @@ -247,6 +270,7 @@ public class SelectWifiFragmentView implements MvpView { |
| 247 | 270 | String result = new String(data, "UTF-8"); |
| 248 | 271 | Log.e(TAG, "onCharacteristicChanged: " + result); |
| 249 | 272 | if (result.indexOf(BlufiConstants.WIFI_LINK_OK) != -1) { |
| 273 | + isSetNetSuccess = true; | |
| 250 | 274 | BleManager.getInstance().stopNotify(bleDevice, BlufiConstants.UUID_WIFI_SERVICE.toString(), BlufiConstants.UUID_NOTIFY_CHARACTERISTIC.toString()); |
| 251 | 275 | BleManager.getInstance().disconnect(bleDevice); |
| 252 | 276 | //查询配网是否成功 |
| ... | ... | @@ -257,10 +281,18 @@ public class SelectWifiFragmentView implements MvpView { |
| 257 | 281 | new Handler().postDelayed(new Runnable() { |
| 258 | 282 | @Override |
| 259 | 283 | public void run() { |
| 260 | - fragment.getPresenter().queryConfigDeviceNetResult(getContext(), familyId); | |
| 284 | + fragment.getPresenter().queryConfigDeviceNetResult(getContext(), familyId, new SelectWifiFragmentPresenter.OnResponseListener() { | |
| 285 | + @Override | |
| 286 | + public void onSuccess(NetworkResultBean networkResultBean) { | |
| 287 | + ConnBluetoothSuccessActivity.startActivity(getContext(), networkResultBean); | |
| 288 | + } | |
| 289 | + }); | |
| 261 | 290 | } |
| 262 | - }, DELAY_TIME*1000); | |
| 291 | + }, DELAY_TIME * 1000); | |
| 263 | 292 | } else if (result.indexOf(BlufiConstants.WIFI_LINK_FAIL) != -1) { |
| 293 | + if (null != failHandler && null != failRunnable) { | |
| 294 | + failHandler.removeCallbacks(failRunnable); | |
| 295 | + } | |
| 264 | 296 | if (null != errorDialog) { |
| 265 | 297 | if (!TextUtils.isEmpty(SSID)) { |
| 266 | 298 | errorDialog.setTipMsg(SSID + "\n密码错误"); | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/view/UserManagerView.java
| ... | ... | @@ -179,7 +179,14 @@ public class UserManagerView implements MvpView { |
| 179 | 179 | fragment.binding.btnQrcode.setOnClickListener(new View.OnClickListener() { |
| 180 | 180 | @Override |
| 181 | 181 | public void onClick(View view) { |
| 182 | - InvitFriendActivity.startActivity(getContext()); | |
| 182 | + InvitFriendActivity.startActivity(getContext(), currentSelectFamilyId); | |
| 183 | + } | |
| 184 | + }); | |
| 185 | + //关闭提示按钮 | |
| 186 | + fragment.binding.llCloseTip.setOnClickListener(new View.OnClickListener() { | |
| 187 | + @Override | |
| 188 | + public void onClick(View view) { | |
| 189 | + fragment.binding.flCloseView.setVisibility(View.GONE); | |
| 183 | 190 | } |
| 184 | 191 | }); |
| 185 | 192 | } |
| ... | ... | @@ -349,7 +356,7 @@ public class UserManagerView implements MvpView { |
| 349 | 356 | @Override |
| 350 | 357 | public void onClick(int position, PopMenuInfo popMenuInfo) { |
| 351 | 358 | if (position == 1) { |
| 352 | - BlueToothStep1Activity.startActivity(fragment.getActivity()); | |
| 359 | + InvitFriendActivity.startActivity(getContext(), currentSelectFamilyId); | |
| 353 | 360 | } |
| 354 | 361 | } |
| 355 | 362 | }); | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/model/message/EventMsg.java
| ... | ... | @@ -3,6 +3,7 @@ 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 | 7 | |
| 7 | 8 | private int eventType; |
| 8 | 9 | private Object data; | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/netWork/bean/FamilyListBean.java
| ... | ... | @@ -7,8 +7,8 @@ import java.util.List; |
| 7 | 7 | * 家庭id |
| 8 | 8 | */ |
| 9 | 9 | public class FamilyListBean implements Serializable { |
| 10 | - public static final int THE_HOST = 0;//主人 | |
| 11 | - public static final int THE_MEMBER = 1;//成员 | |
| 10 | + public static final String THE_HOST = "0";//主人 | |
| 11 | + public static final String THE_MEMBER = "1";//成员 | |
| 12 | 12 | |
| 13 | 13 | |
| 14 | 14 | /** |
| ... | ... | @@ -53,7 +53,7 @@ public class FamilyListBean implements Serializable { |
| 53 | 53 | private String userId; |
| 54 | 54 | private String name; |
| 55 | 55 | private String img; |
| 56 | - private int isMaster; | |
| 56 | + private String isMaster; | |
| 57 | 57 | private List<DeviceListBean> deviceList; |
| 58 | 58 | |
| 59 | 59 | public String getId() { |
| ... | ... | @@ -104,11 +104,11 @@ public class FamilyListBean implements Serializable { |
| 104 | 104 | this.img = img; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - public int getIsMaster() { | |
| 107 | + public String getIsMaster() { | |
| 108 | 108 | return isMaster; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - public void setIsMaster(int isMaster) { | |
| 111 | + public void setIsMaster(String isMaster) { | |
| 112 | 112 | this.isMaster = isMaster; |
| 113 | 113 | } |
| 114 | 114 | |
| ... | ... | @@ -985,4 +985,5 @@ public class FamilyListBean implements Serializable { |
| 985 | 985 | } |
| 986 | 986 | } |
| 987 | 987 | } |
| 988 | + | |
| 988 | 989 | } | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/netWork/bean/NetworkResultBean.java
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/netWork/bean/XiaoJiaContactInfo.java
0 → 100644
| 1 | +package com.cnlive.strike.xiaojiaspeaker.netWork.bean; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | + | |
| 5 | +public class XiaoJiaContactInfo { | |
| 6 | + | |
| 7 | + private List<String> sids; | |
| 8 | + | |
| 9 | + public List<String> getSids() { | |
| 10 | + return sids; | |
| 11 | + } | |
| 12 | + | |
| 13 | + public void setSids(List<String> sids) { | |
| 14 | + this.sids = sids; | |
| 15 | + } | |
| 16 | +} | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/activity/BlueToothStep1Activity.java
| ... | ... | @@ -11,7 +11,14 @@ import android.view.View; |
| 11 | 11 | import com.cnlive.libs.base.util.StatusBarUtil; |
| 12 | 12 | import com.cnlive.libs.base.util.StatusBarUtil2; |
| 13 | 13 | import com.cnlive.strike.xiaojiaspeaker.R; |
| 14 | +import com.cnlive.strike.xiaojiaspeaker.commonInfo.XiaoJIaCommInfo; | |
| 14 | 15 | import com.cnlive.strike.xiaojiaspeaker.databinding.ActivityBlueToothStep1Binding; |
| 16 | +import com.cnlive.strike.xiaojiaspeaker.model.message.EventMsg; | |
| 17 | +import com.cnlive.strike.xiaojiaspeaker.util.EventBusUtil; | |
| 18 | + | |
| 19 | +import org.greenrobot.eventbus.EventBus; | |
| 20 | +import org.greenrobot.eventbus.Subscribe; | |
| 21 | +import org.greenrobot.eventbus.ThreadMode; | |
| 15 | 22 | |
| 16 | 23 | public class BlueToothStep1Activity extends AppCompatActivity { |
| 17 | 24 | private ActivityBlueToothStep1Binding binding; |
| ... | ... | @@ -20,17 +27,23 @@ public class BlueToothStep1Activity extends AppCompatActivity { |
| 20 | 27 | protected void onCreate(Bundle savedInstanceState) { |
| 21 | 28 | super.onCreate(savedInstanceState); |
| 22 | 29 | binding = DataBindingUtil.setContentView(this, R.layout.activity_blue_tooth_step1); |
| 30 | + EventBusUtil.register(this); | |
| 23 | 31 | initTopBar(); |
| 24 | 32 | initView(); |
| 25 | 33 | } |
| 26 | 34 | |
| 35 | + @Override | |
| 36 | + protected void onDestroy() { | |
| 37 | + super.onDestroy(); | |
| 38 | + EventBusUtil.unRegister(this); | |
| 39 | + } | |
| 40 | + | |
| 27 | 41 | private void initView() { |
| 28 | 42 | //下一步 |
| 29 | 43 | binding.btnNext.setOnClickListener(new View.OnClickListener() { |
| 30 | 44 | @Override |
| 31 | 45 | public void onClick(View view) { |
| 32 | 46 | BlueToothStep2Activity.startActivity(BlueToothStep1Activity.this); |
| 33 | - finish(); | |
| 34 | 47 | } |
| 35 | 48 | }); |
| 36 | 49 | } |
| ... | ... | @@ -52,4 +65,11 @@ public class BlueToothStep1Activity extends AppCompatActivity { |
| 52 | 65 | public static void startActivity(Activity activity) { |
| 53 | 66 | activity.startActivity(new Intent(activity, BlueToothStep1Activity.class)); |
| 54 | 67 | } |
| 68 | + | |
| 69 | + @Subscribe(threadMode = ThreadMode.MAIN) | |
| 70 | + public void event(EventMsg msg) { | |
| 71 | + if (EventMsg.CLOSE_BLUETOOTH_ACTIVITY == msg.getEventType()) { | |
| 72 | + finish(); | |
| 73 | + } | |
| 74 | + } | |
| 55 | 75 | } | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/activity/BlueToothStep2Activity.java
| ... | ... | @@ -26,11 +26,16 @@ import com.cnlive.libs.base.util.StatusBarUtil; |
| 26 | 26 | import com.cnlive.libs.base.util.StatusBarUtil2; |
| 27 | 27 | import com.cnlive.strike.xiaojiaspeaker.R; |
| 28 | 28 | import com.cnlive.strike.xiaojiaspeaker.databinding.ActivityBlueToothStep2Binding; |
| 29 | +import com.cnlive.strike.xiaojiaspeaker.model.message.EventMsg; | |
| 29 | 30 | import com.cnlive.strike.xiaojiaspeaker.ui.widget.SelectDialog; |
| 31 | +import com.cnlive.strike.xiaojiaspeaker.util.EventBusUtil; | |
| 30 | 32 | import com.cnlive.strike.xiaojiaspeaker.util.lib_permisshelper.PermissionsListener; |
| 31 | 33 | import com.cnlive.strike.xiaojiaspeaker.util.lib_permisshelper.PermissionsUtils; |
| 32 | 34 | import com.cnlive.strike.xiaojiaspeaker.util.utilcode.CheckUtil; |
| 33 | 35 | |
| 36 | +import org.greenrobot.eventbus.Subscribe; | |
| 37 | +import org.greenrobot.eventbus.ThreadMode; | |
| 38 | + | |
| 34 | 39 | public class BlueToothStep2Activity extends AppCompatActivity { |
| 35 | 40 | private ActivityBlueToothStep2Binding binding; |
| 36 | 41 | private PermissionsUtils mPermissionsUtils = new PermissionsUtils();//权限申请 |
| ... | ... | @@ -43,6 +48,8 @@ public class BlueToothStep2Activity extends AppCompatActivity { |
| 43 | 48 | protected void onCreate(Bundle savedInstanceState) { |
| 44 | 49 | super.onCreate(savedInstanceState); |
| 45 | 50 | binding = DataBindingUtil.setContentView(this, R.layout.activity_blue_tooth_step2); |
| 51 | + EventBusUtil.register(this); | |
| 52 | + | |
| 46 | 53 | initTopBar(); |
| 47 | 54 | initView(); |
| 48 | 55 | initPermissionDefineTip(); |
| ... | ... | @@ -55,6 +62,7 @@ public class BlueToothStep2Activity extends AppCompatActivity { |
| 55 | 62 | if (null != mStatusReceive) { |
| 56 | 63 | unregisterReceiver(mStatusReceive); |
| 57 | 64 | } |
| 65 | + EventBusUtil.unRegister(this); | |
| 58 | 66 | } |
| 59 | 67 | |
| 60 | 68 | private void initBlueToothReceiver() { |
| ... | ... | @@ -69,7 +77,7 @@ public class BlueToothStep2Activity extends AppCompatActivity { |
| 69 | 77 | binding.tvPreviousStep.setOnClickListener(new View.OnClickListener() { |
| 70 | 78 | @Override |
| 71 | 79 | public void onClick(View view) { |
| 72 | - BlueToothStep1Activity.startActivity(BlueToothStep2Activity.this); | |
| 80 | +// BlueToothStep1Activity.startActivity(BlueToothStep2Activity.this); | |
| 73 | 81 | finish(); |
| 74 | 82 | } |
| 75 | 83 | }); |
| ... | ... | @@ -127,7 +135,6 @@ public class BlueToothStep2Activity extends AppCompatActivity { |
| 127 | 135 | //判断蓝牙是否打开 |
| 128 | 136 | if (BleManager.getInstance().isBlueEnable()) { |
| 129 | 137 | SearchDeviceActivity.startActivity(BlueToothStep2Activity.this); |
| 130 | - finish(); | |
| 131 | 138 | } else { |
| 132 | 139 | BleManager.getInstance().enableBluetooth(); |
| 133 | 140 | } |
| ... | ... | @@ -244,4 +251,10 @@ public class BlueToothStep2Activity extends AppCompatActivity { |
| 244 | 251 | } |
| 245 | 252 | }; |
| 246 | 253 | |
| 254 | + @Subscribe(threadMode = ThreadMode.MAIN) | |
| 255 | + public void event(EventMsg msg) { | |
| 256 | + if (EventMsg.CLOSE_BLUETOOTH_ACTIVITY == msg.getEventType()) { | |
| 257 | + finish(); | |
| 258 | + } | |
| 259 | + } | |
| 247 | 260 | } | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/activity/ChangeWifiActivity.java
0 → 100644
| 1 | +package com.cnlive.strike.xiaojiaspeaker.ui.activity; | |
| 2 | + | |
| 3 | +import android.Manifest; | |
| 4 | +import android.app.Activity; | |
| 5 | +import android.content.Intent; | |
| 6 | +import android.content.pm.PackageManager; | |
| 7 | +import android.net.Uri; | |
| 8 | +import android.os.Bundle; | |
| 9 | +import android.os.Handler; | |
| 10 | +import android.provider.Settings; | |
| 11 | +import android.support.annotation.NonNull; | |
| 12 | +import android.support.v4.app.ActivityCompat; | |
| 13 | +import android.support.v7.app.AppCompatActivity; | |
| 14 | +import android.util.Log; | |
| 15 | + | |
| 16 | +import com.clj.fastble.data.BleDevice; | |
| 17 | +import com.cnlive.strike.xiaojiaspeaker.R; | |
| 18 | +import com.cnlive.strike.xiaojiaspeaker.ui.fragment.SelectWifiFragment; | |
| 19 | +import com.cnlive.strike.xiaojiaspeaker.ui.widget.SelectDialog; | |
| 20 | +import com.cnlive.strike.xiaojiaspeaker.util.WifiUtils; | |
| 21 | +import com.cnlive.strike.xiaojiaspeaker.util.lib_permisshelper.PermissionsListener; | |
| 22 | +import com.cnlive.strike.xiaojiaspeaker.util.lib_permisshelper.PermissionsUtils; | |
| 23 | + | |
| 24 | +public class ChangeWifiActivity extends AppCompatActivity { | |
| 25 | + private PermissionsUtils mPermissionsUtils = new PermissionsUtils();//权限申请 | |
| 26 | + private int permissionRequestCount = 0;//权限请求次数 | |
| 27 | + private SelectDialog selectDialog; | |
| 28 | + private WifiUtils wifiUtils; | |
| 29 | + private String TAG = "ChangeWifiActivity"; | |
| 30 | + private BleDevice bleDevice; | |
| 31 | + private boolean isFirstCheckWifi = true; | |
| 32 | + private Runnable wifiRunable; | |
| 33 | + private Handler handler; | |
| 34 | + | |
| 35 | + @Override | |
| 36 | + protected void onCreate(Bundle savedInstanceState) { | |
| 37 | + super.onCreate(savedInstanceState); | |
| 38 | + setContentView(R.layout.activity_select_wifi); | |
| 39 | + if (null != getIntent().getExtras()) { | |
| 40 | + bleDevice = (BleDevice) getIntent().getExtras().get("bleDevice"); | |
| 41 | + } | |
| 42 | + wifiUtils = new WifiUtils(this); | |
| 43 | +// registerBroadcast(); | |
| 44 | +// getPermissionsWithTip(); | |
| 45 | + getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, SelectWifiFragment.newInstance(bleDevice)).commitAllowingStateLoss(); | |
| 46 | + } | |
| 47 | + | |
| 48 | + | |
| 49 | + private void initPermissionDefineTip() { | |
| 50 | + selectDialog = new SelectDialog(ChangeWifiActivity.this, "您尚未授予程序运行所需权限\n是否设置?", | |
| 51 | + "返回", new SelectDialog.DialogInterface() { | |
| 52 | + @Override | |
| 53 | + public void onClick(SelectDialog dialog) { | |
| 54 | + dialog.dismiss(); | |
| 55 | + finish(); | |
| 56 | + } | |
| 57 | + }, "设置", new SelectDialog.DialogInterface() { | |
| 58 | + @Override | |
| 59 | + public void onClick(SelectDialog dialog) { | |
| 60 | + dialog.dismiss(); | |
| 61 | + Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); | |
| 62 | + Uri uri = Uri.fromParts("package", getPackageName(), null); | |
| 63 | + intent.setData(uri); | |
| 64 | + startActivityForResult(intent, 0); | |
| 65 | + permissionRequestCount = 0; | |
| 66 | + } | |
| 67 | + }); | |
| 68 | + selectDialog.setRightBtnColor(R.color.green); | |
| 69 | + | |
| 70 | + } | |
| 71 | + | |
| 72 | + @Override | |
| 73 | + protected void onResume() { | |
| 74 | + super.onResume(); | |
| 75 | + Log.e(TAG, "onResume: " + wifiUtils.isOpenWifi()); | |
| 76 | + } | |
| 77 | + | |
| 78 | + /** | |
| 79 | + * 一次申请一组权限(使用拒绝弹框)点击事件 | |
| 80 | + */ | |
| 81 | + public void getPermissionsWithTip() { | |
| 82 | + if (1 == permissionRequestCount) { | |
| 83 | + return; | |
| 84 | + } | |
| 85 | + mPermissionsUtils | |
| 86 | + .setPermissionsListener(new PermissionsListener() { | |
| 87 | + @Override | |
| 88 | + public void onDenied(String[] deniedPermissions) { | |
| 89 | +// getPermissionsWithTip(); | |
| 90 | + } | |
| 91 | + | |
| 92 | + @Override | |
| 93 | + public void onGranted() { | |
| 94 | + //判断蓝牙是否打开 | |
| 95 | + if (null == getSupportFragmentManager().findFragmentById(R.id.fragment_container)) { | |
| 96 | + //判断wifi是否打开 | |
| 97 | + if (!wifiUtils.isOpenWifi()) { | |
| 98 | + wifiUtils.openWifi(); | |
| 99 | + } | |
| 100 | + } | |
| 101 | + } | |
| 102 | + }) | |
| 103 | + .withActivity(ChangeWifiActivity.this) | |
| 104 | + .getPermissions(ChangeWifiActivity.this | |
| 105 | + , 100 | |
| 106 | + , Manifest.permission.INTERNET | |
| 107 | + , Manifest.permission.ACCESS_FINE_LOCATION | |
| 108 | + , Manifest.permission.ACCESS_COARSE_LOCATION | |
| 109 | + ); | |
| 110 | +// .getPermissionsWithTips(MainActivity.this | |
| 111 | +// ,100 | |
| 112 | +// , new String[]{"人家要录音","我们需要读取你的信息,磨磨唧唧的","我要上网","我要读内存卡","我要看日历","我要定位"} | |
| 113 | +// , Manifest.permission.RECORD_AUDIO | |
| 114 | +// , Manifest.permission.READ_SMS | |
| 115 | +// , Manifest.permission.INTERNET | |
| 116 | +// , Manifest.permission.READ_EXTERNAL_STORAGE | |
| 117 | +// , Manifest.permission.READ_CALENDAR | |
| 118 | +// , Manifest.permission.ACCESS_FINE_LOCATION); | |
| 119 | + } | |
| 120 | + | |
| 121 | + /** | |
| 122 | + * 权限回调 | |
| 123 | + * | |
| 124 | + * @param requestCode | |
| 125 | + * @param permissions | |
| 126 | + * @param grantResults | |
| 127 | + */ | |
| 128 | + @Override | |
| 129 | + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, | |
| 130 | + @NonNull int[] grantResults) { | |
| 131 | + super.onRequestPermissionsResult(requestCode, permissions, grantResults); | |
| 132 | + if (1 == permissionRequestCount) { | |
| 133 | + return; | |
| 134 | + } | |
| 135 | + boolean isShowPermissionTip = true; | |
| 136 | + for (int i = 0; i < grantResults.length; i++) {//判断权限的结果,如果有被拒绝,就return | |
| 137 | + if (grantResults[i] == PackageManager.PERMISSION_DENIED) { | |
| 138 | + if (!ActivityCompat.shouldShowRequestPermissionRationale(this, permissions[i])) { | |
| 139 | + isShowPermissionTip = false; | |
| 140 | + break; | |
| 141 | + } | |
| 142 | + } | |
| 143 | + } | |
| 144 | + if (isShowPermissionTip) { | |
| 145 | + mPermissionsUtils.dealResult(requestCode, permissions, grantResults); | |
| 146 | + } else { | |
| 147 | + if (0 == permissionRequestCount) { | |
| 148 | + selectDialog.setCancelable(false); | |
| 149 | + selectDialog.setCanceledOnTouchOutside(false); | |
| 150 | + if (!selectDialog.isShowing()) { | |
| 151 | + selectDialog.show(); | |
| 152 | + permissionRequestCount = 1; | |
| 153 | + } | |
| 154 | + } else { | |
| 155 | + return; | |
| 156 | + } | |
| 157 | + } | |
| 158 | + } | |
| 159 | + | |
| 160 | + @Override | |
| 161 | + protected void onDestroy() { | |
| 162 | + super.onDestroy(); | |
| 163 | +// if (null != mBroadcastReceiver) { | |
| 164 | +// unregisterReceiver(mBroadcastReceiver); | |
| 165 | +// } | |
| 166 | + } | |
| 167 | + | |
| 168 | +// private void registerBroadcast() { | |
| 169 | +// IntentFilter intentFilter = new IntentFilter(); | |
| 170 | +// intentFilter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION); | |
| 171 | +// intentFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION); | |
| 172 | +// intentFilter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION); | |
| 173 | +// intentFilter.addAction(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION); | |
| 174 | +// registerReceiver(mBroadcastReceiver, intentFilter); | |
| 175 | +// } | |
| 176 | + | |
| 177 | +// private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() { | |
| 178 | +// @Override | |
| 179 | +// public void onReceive(Context context, final Intent intent) { | |
| 180 | +// String resultAction = intent.getAction(); | |
| 181 | +// //当扫描结果后,进行刷新列表 | |
| 182 | +// if (intent.getAction().equals(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)) { | |
| 183 | +// Log.e(TAG, "onReceive: SCAN_RESULTS_AVAILABLE_ACTION"); | |
| 184 | +// if (null == getSupportFragmentManager().findFragmentById(R.id.fragment_container)) { | |
| 185 | +// getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new SelectWifiFragment()).commitAllowingStateLoss(); | |
| 186 | +// } | |
| 187 | +// } else if (intent.getAction().equals(WifiManager.NETWORK_STATE_CHANGED_ACTION)) {//wifi连接网络状态变化 | |
| 188 | +// NetworkInfo.DetailedState state = ((NetworkInfo) intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO)).getDetailedState(); | |
| 189 | +// Log.e(TAG, "onReceive: NETWORK_STATE_CHANGED_ACTION" + wifiUtils.isOpenWifi()); | |
| 190 | +// if (null == getSupportFragmentManager().findFragmentById(R.id.fragment_container)) { | |
| 191 | +// new Handler().postDelayed(new Runnable() { | |
| 192 | +// @Override | |
| 193 | +// public void run() { | |
| 194 | +// if (null == getSupportFragmentManager().findFragmentById(R.id.fragment_container)) { | |
| 195 | +// int mWifiState = intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE, 0); | |
| 196 | +// if (mWifiState!=WifiManager.WIFI_STATE_ENABLING||mWifiState!=WifiManager.WIFI_STATE_ENABLED) { | |
| 197 | +// finish(); | |
| 198 | +// }else { | |
| 199 | +// getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new SelectWifiFragment()).commitAllowingStateLoss(); | |
| 200 | +// } | |
| 201 | +// } | |
| 202 | +// } | |
| 203 | +// }, 2000); | |
| 204 | +// } | |
| 205 | +// | |
| 206 | +// } | |
| 207 | +// if (intent.getAction().equals(WifiManager.WIFI_STATE_CHANGED_ACTION)) {//wifi状态变化 | |
| 208 | +// } else if (intent.getAction().equals(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION)) { | |
| 209 | +// | |
| 210 | +// } | |
| 211 | +// } | |
| 212 | +// }; | |
| 213 | + | |
| 214 | + public static void StartActivity(Activity activity, BleDevice bleDevice) { | |
| 215 | + Intent intent = new Intent(activity, ChangeWifiActivity.class); | |
| 216 | + intent.putExtra("bleDevice", bleDevice); | |
| 217 | + activity.startActivity(intent); | |
| 218 | + } | |
| 219 | +} | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/activity/ConnBluetoothSuccessActivity.java
| ... | ... | @@ -6,6 +6,7 @@ import android.databinding.DataBindingUtil; |
| 6 | 6 | import android.support.v4.content.ContextCompat; |
| 7 | 7 | import android.support.v7.app.AppCompatActivity; |
| 8 | 8 | import android.os.Bundle; |
| 9 | +import android.text.TextUtils; | |
| 9 | 10 | import android.view.View; |
| 10 | 11 | |
| 11 | 12 | import com.cnlive.libs.base.util.StatusBarUtil; |
| ... | ... | @@ -13,6 +14,7 @@ import com.cnlive.libs.base.util.StatusBarUtil2; |
| 13 | 14 | import com.cnlive.strike.xiaojiaspeaker.R; |
| 14 | 15 | import com.cnlive.strike.xiaojiaspeaker.commonInfo.XiaoJIaCommInfo; |
| 15 | 16 | import com.cnlive.strike.xiaojiaspeaker.databinding.ActivityConnBluetoothSuccessBinding; |
| 17 | +import com.cnlive.strike.xiaojiaspeaker.netWork.bean.NetworkResultBean; | |
| 16 | 18 | import com.daimajia.androidanimations.library.Techniques; |
| 17 | 19 | import com.daimajia.androidanimations.library.YoYo; |
| 18 | 20 | |
| ... | ... | @@ -23,11 +25,15 @@ import com.daimajia.androidanimations.library.YoYo; |
| 23 | 25 | */ |
| 24 | 26 | public class ConnBluetoothSuccessActivity extends AppCompatActivity { |
| 25 | 27 | private ActivityConnBluetoothSuccessBinding binding; |
| 28 | + private NetworkResultBean networkResultBean; | |
| 26 | 29 | |
| 27 | 30 | @Override |
| 28 | 31 | protected void onCreate(Bundle savedInstanceState) { |
| 29 | 32 | super.onCreate(savedInstanceState); |
| 30 | 33 | binding = DataBindingUtil.setContentView(this, R.layout.activity_conn_bluetooth_success); |
| 34 | + if (null != getIntent().getExtras()) { | |
| 35 | + networkResultBean = (NetworkResultBean) getIntent().getExtras().getSerializable("networkResultBean"); | |
| 36 | + } | |
| 31 | 37 | initTopBar(); |
| 32 | 38 | initView(); |
| 33 | 39 | } |
| ... | ... | @@ -59,6 +65,29 @@ public class ConnBluetoothSuccessActivity extends AppCompatActivity { |
| 59 | 65 | XiaoJIaCommInfo.setIsShowConnGift(ConnBluetoothSuccessActivity.this, false); |
| 60 | 66 | } |
| 61 | 67 | }); |
| 68 | + //邀请使用者 | |
| 69 | + binding.btnInvitFriend.setOnClickListener(new View.OnClickListener() { | |
| 70 | + @Override | |
| 71 | + public void onClick(View view) { | |
| 72 | + | |
| 73 | + } | |
| 74 | + }); | |
| 75 | + //修改音箱名称 | |
| 76 | + binding.tvSetDeviceName.setOnClickListener(new View.OnClickListener() { | |
| 77 | + @Override | |
| 78 | + public void onClick(View view) { | |
| 79 | + if (null != networkResultBean && !TextUtils.isEmpty(networkResultBean.getMainctl())) { | |
| 80 | + ChangeDeviceNameActivity.startActivity(ConnBluetoothSuccessActivity.this, networkResultBean.getMainctl()); | |
| 81 | + } | |
| 82 | + } | |
| 83 | + }); | |
| 84 | + //完成 | |
| 85 | + binding.btnFinish.setOnClickListener(new View.OnClickListener() { | |
| 86 | + @Override | |
| 87 | + public void onClick(View view) { | |
| 88 | + finish(); | |
| 89 | + } | |
| 90 | + }); | |
| 62 | 91 | } |
| 63 | 92 | |
| 64 | 93 | public void showGift() { |
| ... | ... | @@ -86,7 +115,9 @@ public class ConnBluetoothSuccessActivity extends AppCompatActivity { |
| 86 | 115 | } |
| 87 | 116 | } |
| 88 | 117 | |
| 89 | - public static void startActivity(Activity activity) { | |
| 90 | - activity.startActivity(new Intent(activity, ConnBluetoothSuccessActivity.class)); | |
| 118 | + public static void startActivity(Activity activity, NetworkResultBean networkResultBean) { | |
| 119 | + Intent intent = new Intent(activity, ConnBluetoothSuccessActivity.class); | |
| 120 | + intent.putExtra("networkResultBean", networkResultBean); | |
| 121 | + activity.startActivity(intent); | |
| 91 | 122 | } |
| 92 | 123 | } | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/activity/InvitFriendActivity.java
| ... | ... | @@ -4,6 +4,7 @@ import android.app.Activity; |
| 4 | 4 | import android.content.Intent; |
| 5 | 5 | import android.support.v7.app.AppCompatActivity; |
| 6 | 6 | import android.os.Bundle; |
| 7 | +import android.text.TextUtils; | |
| 7 | 8 | |
| 8 | 9 | import com.cnlive.strike.xiaojiaspeaker.R; |
| 9 | 10 | import com.cnlive.strike.xiaojiaspeaker.ui.fragment.AllDeviceFragment; |
| ... | ... | @@ -18,12 +19,19 @@ public class InvitFriendActivity extends AppCompatActivity { |
| 18 | 19 | protected void onCreate(Bundle savedInstanceState) { |
| 19 | 20 | super.onCreate(savedInstanceState); |
| 20 | 21 | setContentView(R.layout.activity_invit_friend); |
| 21 | - getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, InvitFriendFragment.newInstance()).commitAllowingStateLoss(); | |
| 22 | + if (null != getIntent().getExtras()) { | |
| 23 | + String currentSelectFamilyId = getIntent().getExtras().getString("currentSelectFamilyId"); | |
| 24 | + if (!TextUtils.isEmpty(currentSelectFamilyId)) { | |
| 25 | + getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, InvitFriendFragment.newInstance(currentSelectFamilyId)).commitAllowingStateLoss(); | |
| 26 | + } | |
| 27 | + } | |
| 28 | + | |
| 22 | 29 | |
| 23 | 30 | } |
| 24 | 31 | |
| 25 | - public static void startActivity(Activity activity) { | |
| 32 | + public static void startActivity(Activity activity, String currentSelectFamilyId) { | |
| 26 | 33 | Intent intent = new Intent(activity, InvitFriendActivity.class); |
| 34 | + intent.putExtra("currentSelectFamilyId", currentSelectFamilyId); | |
| 27 | 35 | activity.startActivity(intent); |
| 28 | 36 | } |
| 29 | 37 | } | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/adapter/SelectIMFriendAdapter.java
| ... | ... | @@ -160,7 +160,7 @@ public class SelectIMFriendAdapter extends RecyclerView.Adapter { |
| 160 | 160 | //设置是否选中 |
| 161 | 161 | binding.checkBox.toggle(); |
| 162 | 162 | } else { |
| 163 | - AlertUtil.showDeftToast(context, "该联系人不可选择"); | |
| 163 | + AlertUtil.showDeftToast(context, "该好友已加入"); | |
| 164 | 164 | return; |
| 165 | 165 | } |
| 166 | 166 | hasSelectMap.put(imFriendInfoList.get(getAdapterPosition()).getId(), binding.checkBox.isChecked()); | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/fragment/ChangeWifiFragment.java
0 → 100644
| 1 | +package com.cnlive.strike.xiaojiaspeaker.ui.fragment; | |
| 2 | + | |
| 3 | +import android.content.BroadcastReceiver; | |
| 4 | +import android.content.Context; | |
| 5 | +import android.content.Intent; | |
| 6 | +import android.content.IntentFilter; | |
| 7 | +import android.net.NetworkInfo; | |
| 8 | +import android.net.wifi.WifiManager; | |
| 9 | +import android.os.Bundle; | |
| 10 | +import android.support.annotation.Nullable; | |
| 11 | +import android.support.v4.content.ContextCompat; | |
| 12 | +import android.util.Log; | |
| 13 | +import android.view.View; | |
| 14 | + | |
| 15 | +import com.clj.fastble.data.BleDevice; | |
| 16 | +import com.cnlive.libs.base.frame.fragment.MvpBindingFragment; | |
| 17 | +import com.cnlive.libs.base.util.StatusBarUtil; | |
| 18 | +import com.cnlive.libs.base.util.StatusBarUtil2; | |
| 19 | +import com.cnlive.strike.xiaojiaspeaker.R; | |
| 20 | +import com.cnlive.strike.xiaojiaspeaker.databinding.FragmentSelectWifiBinding; | |
| 21 | +import com.cnlive.strike.xiaojiaspeaker.frame.presenter.SelectWifiFragmentPresenter; | |
| 22 | +import com.cnlive.strike.xiaojiaspeaker.frame.view.SelectWifiFragmentView; | |
| 23 | +import com.cnlive.strike.xiaojiaspeaker.model.message.EventMsg; | |
| 24 | +import com.cnlive.strike.xiaojiaspeaker.util.EventBusUtil; | |
| 25 | + | |
| 26 | +import org.greenrobot.eventbus.Subscribe; | |
| 27 | +import org.greenrobot.eventbus.ThreadMode; | |
| 28 | + | |
| 29 | +public class ChangeWifiFragment extends MvpBindingFragment<SelectWifiFragmentView, SelectWifiFragmentPresenter, Object, FragmentSelectWifiBinding> { | |
| 30 | + private String TAG = "SelectWifiFragment"; | |
| 31 | + | |
| 32 | + public static ChangeWifiFragment newInstance(BleDevice bleDevice) { | |
| 33 | + Bundle bundle = new Bundle(); | |
| 34 | + bundle.putParcelable("bleDevice", bleDevice); | |
| 35 | + ChangeWifiFragment fragment = new ChangeWifiFragment(); | |
| 36 | + fragment.setArguments(bundle); | |
| 37 | + return fragment; | |
| 38 | + } | |
| 39 | + | |
| 40 | + @Override | |
| 41 | + protected int getLayoutId() { | |
| 42 | + return R.layout.fragment_select_wifi; | |
| 43 | + } | |
| 44 | + | |
| 45 | + @Override | |
| 46 | + public void onActivityCreated(@Nullable Bundle savedInstanceState) { | |
| 47 | + super.onActivityCreated(savedInstanceState); | |
| 48 | + StatusBarUtil.setStatusBarWrite(getActivity()); | |
| 49 | + StatusBarUtil2.setColor(getActivity(), ContextCompat.getColor(getActivity(), R.color.white), 0); | |
| 50 | + } | |
| 51 | + | |
| 52 | + @Override | |
| 53 | + public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | |
| 54 | + super.onViewCreated(view, savedInstanceState); | |
| 55 | + EventBusUtil.register(this); | |
| 56 | + | |
| 57 | + initTopBar(); | |
| 58 | + if (null != getArguments()) { | |
| 59 | + BleDevice bleDevice = (BleDevice) getArguments().get("bleDevice"); | |
| 60 | + if (null != getMvpView() && null != bleDevice) { | |
| 61 | + getMvpView().initWifiList(bleDevice); | |
| 62 | + registerBroadcast(); | |
| 63 | + } | |
| 64 | + } | |
| 65 | + | |
| 66 | + } | |
| 67 | + | |
| 68 | + | |
| 69 | + private void initTopBar() { | |
| 70 | + StatusBarUtil.setStatusBarWrite(getActivity()); | |
| 71 | + StatusBarUtil2.setColor(getActivity(), ContextCompat.getColor(getActivity(), R.color.white), 0); | |
| 72 | + if (null != binding) { | |
| 73 | + binding.topbar.setTitle("请选择WIFI网络").setTextColor(ContextCompat.getColor(getActivity(), R.color.color_282828)); | |
| 74 | + //设置返回按钮 | |
| 75 | + binding.topbar.addLeftImageButton(R.drawable.icon_back, R.id.left_back).setOnClickListener(new View.OnClickListener() { | |
| 76 | + @Override | |
| 77 | + public void onClick(View view) { | |
| 78 | + if (null != getActivity()) { | |
| 79 | + getActivity().finish(); | |
| 80 | + } | |
| 81 | + } | |
| 82 | + }); | |
| 83 | + } | |
| 84 | + } | |
| 85 | + | |
| 86 | + private void registerBroadcast() { | |
| 87 | + IntentFilter intentFilter = new IntentFilter(); | |
| 88 | + intentFilter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION); | |
| 89 | + intentFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION); | |
| 90 | + intentFilter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION); | |
| 91 | + intentFilter.addAction(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION); | |
| 92 | + getActivity().registerReceiver(mBroadcastReceiver, intentFilter); | |
| 93 | + } | |
| 94 | + | |
| 95 | + @Override | |
| 96 | + public void onDestroy() { | |
| 97 | + super.onDestroy(); | |
| 98 | + EventBusUtil.unRegister(this); | |
| 99 | + if (null != mBroadcastReceiver) { | |
| 100 | + getActivity().unregisterReceiver(mBroadcastReceiver); | |
| 101 | + } | |
| 102 | + } | |
| 103 | + | |
| 104 | + private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() { | |
| 105 | + @Override | |
| 106 | + public void onReceive(Context context, Intent intent) { | |
| 107 | + String resultAction = intent.getAction(); | |
| 108 | + //当扫描结果后,进行刷新列表 | |
| 109 | + if (intent.getAction().equals(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)) { | |
| 110 | + Log.e(TAG, "onReceive: SCAN_RESULTS_AVAILABLE_ACTION"); | |
| 111 | + //扫描wifi | |
| 112 | + if (null != getMvpView()) { | |
| 113 | + getMvpView().updateWifiList(); | |
| 114 | + } | |
| 115 | + } else if (intent.getAction().equals(WifiManager.NETWORK_STATE_CHANGED_ACTION)) { | |
| 116 | + Log.e(TAG, "onReceive: NETWORK_STATE_CHANGED_ACTION"); | |
| 117 | + //wifi连接网络状态变化 | |
| 118 | + NetworkInfo.DetailedState state = ((NetworkInfo) intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO)).getDetailedState(); | |
| 119 | + } else if (intent.getAction().equals(WifiManager.WIFI_STATE_CHANGED_ACTION)) {//wifi状态变化 | |
| 120 | + int wifiState = intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE, WifiManager.WIFI_STATE_DISABLED); | |
| 121 | + } else if (intent.getAction().equals(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION)) { | |
| 122 | + } | |
| 123 | + } | |
| 124 | + }; | |
| 125 | + | |
| 126 | + @Subscribe(threadMode = ThreadMode.MAIN) | |
| 127 | + public void event(EventMsg msg) { | |
| 128 | + if (EventMsg.CLOSE_BLUETOOTH_ACTIVITY == msg.getEventType()) { | |
| 129 | + getActivity().finish(); | |
| 130 | + } | |
| 131 | + } | |
| 132 | +} | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/fragment/DeviceDetailFragment.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 | |
| 8 | 9 | import com.cnlive.libs.base.frame.fragment.MvpBindingFragment; |
| ... | ... | @@ -38,7 +39,7 @@ public class DeviceDetailFragment extends MvpBindingFragment<DeviceDetailView, D |
| 38 | 39 | String currentSelectFamilyId = getArguments().getString("currentSelectFamilyId"); |
| 39 | 40 | if (null != getMvpView()) { |
| 40 | 41 | initTopBar(allDeviceInfo.getName()); |
| 41 | - getMvpView().initView(allDeviceInfo,currentSelectFamilyId); | |
| 42 | + getMvpView().initView(allDeviceInfo, currentSelectFamilyId); | |
| 42 | 43 | } |
| 43 | 44 | } |
| 44 | 45 | } |
| ... | ... | @@ -74,7 +75,19 @@ public class DeviceDetailFragment extends MvpBindingFragment<DeviceDetailView, D |
| 74 | 75 | public void event(EventMsg msg) { |
| 75 | 76 | if (EventMsg.DELETE_DEVICE_NAME_SUCCESS == msg.getEventType()) { |
| 76 | 77 | getActivity().finish(); |
| 78 | + } else if (EventMsg.CHANGE_DEVICE_NAME_SUCCESS == msg.getEventType()) { | |
| 79 | + if (null==getMvpView()){ | |
| 80 | + return; | |
| 81 | + } | |
| 82 | + String deviceName = (String) msg.getData(); | |
| 83 | + if (!TextUtils.isEmpty(deviceName)) { | |
| 84 | + if (null != getActivity()) { | |
| 85 | + binding.topbar.setTitle(deviceName); | |
| 86 | + } | |
| 87 | + } | |
| 77 | 88 | } |
| 89 | + | |
| 90 | + | |
| 78 | 91 | } |
| 79 | 92 | |
| 80 | 93 | } | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/fragment/DeviceManagerFragment.java
| ... | ... | @@ -77,6 +77,7 @@ public class DeviceManagerFragment extends MvpBindingFragment<DeviceManagerFragm |
| 77 | 77 | if (null != getMvpView()) { |
| 78 | 78 | if (null != currentDeviceInfo && !TextUtils.isEmpty(currentDeviceInfo.getMcid())) { |
| 79 | 79 | getPresenter().getDeviceDetailMsg(getActivity(), currentDeviceInfo.getMcid()); |
| 80 | + | |
| 80 | 81 | } |
| 81 | 82 | } |
| 82 | 83 | } else if (EventMsg.DELETE_DEVICE_NAME_SUCCESS == msg.getEventType()) { | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/fragment/InvitFriendFragment.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 | |
| 8 | 9 | import com.cnlive.libs.base.frame.fragment.MvpBindingFragment; |
| ... | ... | @@ -18,8 +19,11 @@ import com.cnlive.strike.xiaojiaspeaker.frame.view.InvitFriendView; |
| 18 | 19 | * 二维码邀请加入 |
| 19 | 20 | */ |
| 20 | 21 | public class InvitFriendFragment extends MvpBindingFragment<InvitFriendView, InvitFriendPresenter, Object, FragmentInvitFriendBinding> { |
| 21 | - public static InvitFriendFragment newInstance() { | |
| 22 | + public static InvitFriendFragment newInstance(String currentSelectFamilyId) { | |
| 22 | 23 | InvitFriendFragment fragment = new InvitFriendFragment(); |
| 24 | + Bundle bundle = new Bundle(); | |
| 25 | + bundle.putString("currentSelectFamilyId", currentSelectFamilyId); | |
| 26 | + fragment.setArguments(bundle); | |
| 23 | 27 | return fragment; |
| 24 | 28 | } |
| 25 | 29 | |
| ... | ... | @@ -32,8 +36,15 @@ public class InvitFriendFragment extends MvpBindingFragment<InvitFriendView, Inv |
| 32 | 36 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
| 33 | 37 | super.onViewCreated(view, savedInstanceState); |
| 34 | 38 | initTopBar(); |
| 35 | - if(getMvpView() != null) getMvpView().initView(); | |
| 36 | - getPresenter().getSetRoleList(getActivity(), XiaoJIaCommInfo.getUserId(getActivity()), XiaoJIaCommInfo.getFamilyId(getActivity())); | |
| 39 | + if (getMvpView() != null) { | |
| 40 | + if (null != getArguments()) { | |
| 41 | + String currentSelectFamilyId = getArguments().getString("currentSelectFamilyId"); | |
| 42 | + if (!TextUtils.isEmpty(currentSelectFamilyId)) { | |
| 43 | + getMvpView().initView(currentSelectFamilyId); | |
| 44 | + getPresenter().getSetRoleList(getActivity(), XiaoJIaCommInfo.getUserId(getActivity()), currentSelectFamilyId); | |
| 45 | + } | |
| 46 | + } | |
| 47 | + } | |
| 37 | 48 | } |
| 38 | 49 | |
| 39 | 50 | private void initTopBar() { | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/fragment/SearchDevicefragment.java
| ... | ... | @@ -15,8 +15,13 @@ import com.cnlive.strike.xiaojiaspeaker.R; |
| 15 | 15 | import com.cnlive.strike.xiaojiaspeaker.databinding.FragmentSearchDeviceBinding; |
| 16 | 16 | import com.cnlive.strike.xiaojiaspeaker.frame.presenter.SearchDevicefragmentPresenter; |
| 17 | 17 | import com.cnlive.strike.xiaojiaspeaker.frame.view.SearchDevicefragmentView; |
| 18 | +import com.cnlive.strike.xiaojiaspeaker.model.message.EventMsg; | |
| 19 | +import com.cnlive.strike.xiaojiaspeaker.util.EventBusUtil; | |
| 18 | 20 | import com.hannesdorfmann.mosby3.mvp.MvpFragment; |
| 19 | 21 | |
| 22 | +import org.greenrobot.eventbus.Subscribe; | |
| 23 | +import org.greenrobot.eventbus.ThreadMode; | |
| 24 | + | |
| 20 | 25 | /** |
| 21 | 26 | * 搜索音箱界面 |
| 22 | 27 | * |
| ... | ... | @@ -32,6 +37,8 @@ public class SearchDevicefragment extends MvpBindingFragment<SearchDevicefragmen |
| 32 | 37 | @Override |
| 33 | 38 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
| 34 | 39 | super.onViewCreated(view, savedInstanceState); |
| 40 | + EventBusUtil.register(this); | |
| 41 | + | |
| 35 | 42 | initTopBar(); |
| 36 | 43 | initBlueToothScanConfig(); |
| 37 | 44 | if (null != getMvpView()) { |
| ... | ... | @@ -87,5 +94,13 @@ public class SearchDevicefragment extends MvpBindingFragment<SearchDevicefragmen |
| 87 | 94 | BleManager.getInstance().cancelScan(); |
| 88 | 95 | } catch (Exception e) { |
| 89 | 96 | } |
| 97 | + EventBusUtil.unRegister(this); | |
| 98 | + } | |
| 99 | + | |
| 100 | + @Subscribe(threadMode = ThreadMode.MAIN) | |
| 101 | + public void event(EventMsg msg) { | |
| 102 | + if (EventMsg.CLOSE_BLUETOOTH_ACTIVITY == msg.getEventType()) { | |
| 103 | + getActivity().finish(); | |
| 104 | + } | |
| 90 | 105 | } |
| 91 | 106 | } | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/fragment/SelectWifiFragment.java
| ... | ... | @@ -20,7 +20,12 @@ import com.cnlive.strike.xiaojiaspeaker.R; |
| 20 | 20 | import com.cnlive.strike.xiaojiaspeaker.databinding.FragmentSelectWifiBinding; |
| 21 | 21 | import com.cnlive.strike.xiaojiaspeaker.frame.presenter.SelectWifiFragmentPresenter; |
| 22 | 22 | import com.cnlive.strike.xiaojiaspeaker.frame.view.SelectWifiFragmentView; |
| 23 | +import com.cnlive.strike.xiaojiaspeaker.model.message.EventMsg; | |
| 23 | 24 | import com.cnlive.strike.xiaojiaspeaker.netWork.bean.ConfigDeviceNetParam; |
| 25 | +import com.cnlive.strike.xiaojiaspeaker.util.EventBusUtil; | |
| 26 | + | |
| 27 | +import org.greenrobot.eventbus.Subscribe; | |
| 28 | +import org.greenrobot.eventbus.ThreadMode; | |
| 24 | 29 | |
| 25 | 30 | import java.io.Serializable; |
| 26 | 31 | |
| ... | ... | @@ -50,6 +55,8 @@ public class SelectWifiFragment extends MvpBindingFragment<SelectWifiFragmentVie |
| 50 | 55 | @Override |
| 51 | 56 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
| 52 | 57 | super.onViewCreated(view, savedInstanceState); |
| 58 | + EventBusUtil.register(this); | |
| 59 | + | |
| 53 | 60 | initTopBar(); |
| 54 | 61 | if (null != getArguments()) { |
| 55 | 62 | BleDevice bleDevice = (BleDevice) getArguments().get("bleDevice"); |
| ... | ... | @@ -59,12 +66,9 @@ public class SelectWifiFragment extends MvpBindingFragment<SelectWifiFragmentVie |
| 59 | 66 | } |
| 60 | 67 | } |
| 61 | 68 | |
| 62 | - | |
| 63 | - | |
| 64 | 69 | } |
| 65 | 70 | |
| 66 | 71 | |
| 67 | - | |
| 68 | 72 | private void initTopBar() { |
| 69 | 73 | StatusBarUtil.setStatusBarWrite(getActivity()); |
| 70 | 74 | StatusBarUtil2.setColor(getActivity(), ContextCompat.getColor(getActivity(), R.color.white), 0); |
| ... | ... | @@ -94,6 +98,7 @@ public class SelectWifiFragment extends MvpBindingFragment<SelectWifiFragmentVie |
| 94 | 98 | @Override |
| 95 | 99 | public void onDestroy() { |
| 96 | 100 | super.onDestroy(); |
| 101 | + EventBusUtil.unRegister(this); | |
| 97 | 102 | if (null != mBroadcastReceiver) { |
| 98 | 103 | getActivity().unregisterReceiver(mBroadcastReceiver); |
| 99 | 104 | } |
| ... | ... | @@ -120,4 +125,11 @@ public class SelectWifiFragment extends MvpBindingFragment<SelectWifiFragmentVie |
| 120 | 125 | } |
| 121 | 126 | } |
| 122 | 127 | }; |
| 128 | + | |
| 129 | + @Subscribe(threadMode = ThreadMode.MAIN) | |
| 130 | + public void event(EventMsg msg) { | |
| 131 | + if (EventMsg.CLOSE_BLUETOOTH_ACTIVITY == msg.getEventType()) { | |
| 132 | + getActivity().finish(); | |
| 133 | + } | |
| 134 | + } | |
| 123 | 135 | } | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/fragment/UserManagerFragment.java
| ... | ... | @@ -50,12 +50,12 @@ public class UserManagerFragment extends MvpBindingFragment<UserManagerView, Use |
| 50 | 50 | if (null != getMvpView()) { |
| 51 | 51 | if (null != currentSelectFamilyId) { |
| 52 | 52 | getMvpView().setCurrentSelectFamily(currentSelectFamilyId); |
| 53 | + getPresenter().getFamilyRole(getActivity(), XiaoJIaCommInfo.getUserId(getActivity()), currentSelectFamilyId, XiaoJIaCommInfo.getUserPhone(getActivity())); | |
| 53 | 54 | } |
| 54 | 55 | getMvpView().initPopView(); |
| 55 | 56 | // getMvpView().initView(null); |
| 56 | 57 | } |
| 57 | 58 | } |
| 58 | - getPresenter().getFamilyRole(getActivity(), XiaoJIaCommInfo.getUserId(getActivity()), XiaoJIaCommInfo.getFamilyId(getActivity()), XiaoJIaCommInfo.getUserPhone(getActivity())); | |
| 59 | 59 | |
| 60 | 60 | } |
| 61 | 61 | ... | ... |
module_xiaojiaSoundBox/src/main/res/layout/activity_device_info.xml
| ... | ... | @@ -21,7 +21,7 @@ |
| 21 | 21 | android:layout_height="50dp" |
| 22 | 22 | android:layout_marginTop="10dp" |
| 23 | 23 | android:layout_marginBottom="10dp" |
| 24 | - android:background="@drawable/selectable_item_white" | |
| 24 | + android:background="@color/white" | |
| 25 | 25 | android:clickable="true"> |
| 26 | 26 | |
| 27 | 27 | <LinearLayout |
| ... | ... | @@ -78,7 +78,7 @@ |
| 78 | 78 | android:layout_height="50dp" |
| 79 | 79 | android:layout_marginTop="10dp" |
| 80 | 80 | android:layout_marginBottom="10dp" |
| 81 | - android:background="@drawable/selectable_item_white" | |
| 81 | + android:background="@color/white" | |
| 82 | 82 | android:clickable="true"> |
| 83 | 83 | |
| 84 | 84 | <LinearLayout |
| ... | ... | @@ -134,7 +134,7 @@ |
| 134 | 134 | android:layout_height="50dp" |
| 135 | 135 | android:layout_marginTop="10dp" |
| 136 | 136 | android:layout_marginBottom="10dp" |
| 137 | - android:background="@drawable/selectable_item_white" | |
| 137 | + android:background="@color/white" | |
| 138 | 138 | android:clickable="true"> |
| 139 | 139 | |
| 140 | 140 | <LinearLayout | ... | ... |
module_xiaojiaSoundBox/src/main/res/layout/activity_share_friend.xml
| ... | ... | @@ -87,7 +87,7 @@ |
| 87 | 87 | <TextView |
| 88 | 88 | android:layout_width="15dp" |
| 89 | 89 | android:layout_height="15dp" |
| 90 | - android:background="@drawable/shape_green_circle" | |
| 90 | + android:background="@drawable/shape_xiaojia_green_circle" | |
| 91 | 91 | android:gravity="center" |
| 92 | 92 | android:text="1" |
| 93 | 93 | android:textColor="@color/white" |
| ... | ... | @@ -107,7 +107,7 @@ |
| 107 | 107 | <TextView |
| 108 | 108 | android:layout_width="15dp" |
| 109 | 109 | android:layout_height="15dp" |
| 110 | - android:background="@drawable/shape_green_circle" | |
| 110 | + android:background="@drawable/shape_xiaojia_green_circle" | |
| 111 | 111 | android:gravity="center" |
| 112 | 112 | android:text="2" |
| 113 | 113 | android:textColor="@color/white" |
| ... | ... | @@ -127,7 +127,7 @@ |
| 127 | 127 | <TextView |
| 128 | 128 | android:layout_width="15dp" |
| 129 | 129 | android:layout_height="15dp" |
| 130 | - android:background="@drawable/shape_green_circle" | |
| 130 | + android:background="@drawable/shape_xiaojia_green_circle" | |
| 131 | 131 | android:gravity="center" |
| 132 | 132 | android:text="3" |
| 133 | 133 | android:textColor="@color/white" | ... | ... |
module_xiaojiaSoundBox/src/main/res/layout/fragment_select_im_friend.xml
| ... | ... | @@ -60,8 +60,7 @@ |
| 60 | 60 | <android.support.v7.widget.RecyclerView |
| 61 | 61 | android:id="@+id/rv_friends" |
| 62 | 62 | android:layout_width="match_parent" |
| 63 | - android:layout_height="match_parent" | |
| 64 | - android:layout_marginTop="10dp" /> | |
| 63 | + android:layout_height="match_parent" /> | |
| 65 | 64 | |
| 66 | 65 | <com.cnlive.strike.ui.widget.LetterBarView |
| 67 | 66 | android:id="@+id/letterBarView" |
| ... | ... | @@ -80,7 +79,10 @@ |
| 80 | 79 | android:id="@+id/btn_next" |
| 81 | 80 | android:layout_width="match_parent" |
| 82 | 81 | android:layout_height="45dp" |
| 83 | - android:layout_margin="30dp" | |
| 82 | + android:layout_marginLeft="30dp" | |
| 83 | + android:layout_marginTop="10dp" | |
| 84 | + android:layout_marginRight="30dp" | |
| 85 | + android:layout_marginBottom="10dp" | |
| 84 | 86 | android:background="@drawable/selector_btn_green" |
| 85 | 87 | android:text="下一步" |
| 86 | 88 | android:textColor="@color/white" | ... | ... |
module_xiaojiaSoundBox/src/main/res/layout/fragment_user_manager.xml
| ... | ... | @@ -12,6 +12,7 @@ |
| 12 | 12 | android:layout_height="?attr/qmui_topbar_height" /> |
| 13 | 13 | |
| 14 | 14 | <FrameLayout |
| 15 | + android:id="@+id/fl_close_view" | |
| 15 | 16 | android:layout_width="match_parent" |
| 16 | 17 | android:layout_height="45dp" |
| 17 | 18 | android:background="@color/color_F7B054"> |
| ... | ... | @@ -25,6 +26,7 @@ |
| 25 | 26 | android:textSize="14sp" /> |
| 26 | 27 | |
| 27 | 28 | <LinearLayout |
| 29 | + android:id="@+id/ll_close_tip" | |
| 28 | 30 | android:layout_width="wrap_content" |
| 29 | 31 | android:layout_height="match_parent" |
| 30 | 32 | android:layout_gravity="right" | ... | ... |