Commit c28685149c3c3f4f75d96935291aef2e4e2f2259

Authored by YangShuai
1 parent 75f5d477

1 修改配网成功页面

Showing 30 changed files with 984 additions and 315 deletions
app/src/main/java/com/cnlive/strike/xiaojiaspeaker/MainActivity.java
... ... @@ -34,8 +34,8 @@ public class MainActivity extends AppCompatActivity {
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));
... ...
build.gradle
... ... @@ -94,5 +94,6 @@ ext {
94 94 avi = "2.1.3"
95 95 //蓝牙
96 96 BleLib="2.3.4"
  97 + eventBus = "3.1.1"
97 98 }
98 99  
... ...
module_xiaojiaSoundBox/proguard-rules.pro
... ... @@ -19,3 +19,14 @@
19 19 # If you keep the line number information, uncomment this to
20 20 # hide the original source file name.
21 21 #-renamesourcefileattribute SourceFile
  22 +
  23 +-keepattributes *Annotation*
  24 +-keepclassmembers class * {
  25 + @org.greenrobot.eventbus.Subscribe <methods>;
  26 +}
  27 +-keep enum org.greenrobot.eventbus.ThreadMode { *; }
  28 +
  29 +# Only required if you use AsyncExecutor
  30 +-keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent {
  31 + <init>(java.lang.Throwable);
  32 +}
... ...
module_xiaojiaSoundBox/src/main/AndroidManifest.xml
... ... @@ -17,7 +17,8 @@
17 17 <uses-permission android:name="android.permission.INTERNET" />
18 18  
19 19 <application>
20   - <activity android:name=".ui.activity.InvitFriendActivity"></activity>
  20 + <activity android:name=".ui.activity.DeviceInfoActivity"></activity>
  21 + <activity android:name=".ui.activity.InvitFriendActivity" />
21 22 <activity android:name=".ui.activity.UserManagerActivity" />
22 23 <activity android:name=".ui.activity.ChangeDeviceNameActivity" />
23 24 <activity android:name=".ui.activity.DeviceDetailActivity" />
... ...
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/presenter/ChangeDeviceNamePresenter.java
1 1 package com.cnlive.strike.xiaojiaspeaker.frame.presenter;
2 2  
  3 +import android.app.Activity;
3 4 import android.content.Context;
4 5 import android.util.Log;
5 6  
... ... @@ -8,6 +9,7 @@ import com.cnlive.libs.base.logic.callback.DataCallback;
8 9 import com.cnlive.libs.base.logic.callback.FailureCallback;
9 10 import com.cnlive.libs.base.logic.callback.SuccessCallback;
10 11 import com.cnlive.strike.xiaojiaspeaker.frame.view.ChangeDeviceNameView;
  12 +import com.cnlive.strike.xiaojiaspeaker.model.message.EventMsg;
11 13 import com.cnlive.strike.xiaojiaspeaker.netWork.ApiServiceXiaoJia;
12 14 import com.cnlive.strike.xiaojiaspeaker.netWork.bean.RoleNetBean;
13 15 import com.cnlive.strike.xiaojiaspeaker.netWork.bean.APIBaseInfo;
... ... @@ -15,6 +17,8 @@ import com.cnlive.strike.xiaojiaspeaker.netWork.result.SubscriptionRequest;
15 17 import com.cnlive.strike.xiaojiaspeaker.util.QMUITipDialogUtil;
16 18 import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter;
17 19  
  20 +import org.greenrobot.eventbus.EventBus;
  21 +
18 22 import java.util.HashMap;
19 23 import java.util.Map;
20 24  
... ... @@ -24,7 +28,7 @@ public class ChangeDeviceNamePresenter extends MvpBasePresenter&lt;ChangeDeviceName
24 28  
25 29 private String TAG = "ChangeDeviceNamePresenter";
26 30  
27   - public void changeDeviceName(Context context, String deviceId, String newName) {
  31 + public void changeDeviceName(Activity context, String deviceId, String newName) {
28 32 if (null == getView()) {
29 33 return;
30 34 }
... ... @@ -47,6 +51,7 @@ public class ChangeDeviceNamePresenter extends MvpBasePresenter&lt;ChangeDeviceName
47 51 if (null == getView()) {
48 52 return;
49 53 }
  54 + EventBus.getDefault().post(new EventMsg(EventMsg.CHANGE_DEVICE_NAME_SUCCESS, null));
50 55 QMUITipDialogUtil.dismessDialog();
51 56 QMUITipDialogUtil.successDialog(context, "保存成功", 1);
52 57 }
... ...
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/presenter/DeviceDetailPresenter.java 0 → 100644
  1 +package com.cnlive.strike.xiaojiaspeaker.frame.presenter;
  2 +
  3 +import com.cnlive.strike.xiaojiaspeaker.frame.view.DeviceDetailView;
  4 +import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter;
  5 +
  6 +public class DeviceDetailPresenter extends MvpBasePresenter<DeviceDetailView> {
  7 +}
... ...
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/presenter/DeviceManagerFragmentPresenter.java
... ... @@ -8,18 +8,68 @@ 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.DeviceManagerFragmentView;
  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.DeviceDetail;
13 14 import com.cnlive.strike.xiaojiaspeaker.netWork.bean.APIBaseInfo;
14 15 import com.cnlive.strike.xiaojiaspeaker.netWork.result.SubscriptionRequest;
  16 +import com.cnlive.strike.xiaojiaspeaker.util.QMUITipDialogUtil;
15 17 import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter;
16 18  
  19 +import org.greenrobot.eventbus.EventBus;
  20 +
17 21 import java.util.HashMap;
18 22 import java.util.Map;
19 23  
20 24 import io.reactivex.disposables.Disposable;
21 25  
22 26 public class DeviceManagerFragmentPresenter extends MvpBasePresenter<DeviceManagerFragmentView> {
  27 + public void deleteDevice(Context context, String deviceId) {
  28 + if (null == getView()) {
  29 + return;
  30 + }
  31 + QMUITipDialogUtil.loadingDialog(context, "请稍后", false);
  32 + Map<String, String> map = new HashMap<>();
  33 + map.put("devId", deviceId);
  34 + Logic.create(map)
  35 + .action(new Logic.Action<Map<String, String>, APIBaseInfo>() {
  36 + @Override
  37 + public Disposable action(Map<String, String> paramsMap, DataCallback<APIBaseInfo> dataCallback) {
  38 + return SubscriptionRequest.service(ApiServiceXiaoJia.class, api -> api.deleteDevice(paramsMap)).subscribe(context, dataCallback);
  39 + }
  40 + }).<APIBaseInfo<DeviceDetail>>event()
  41 + .setSuccessCallback(new SuccessCallback<APIBaseInfo<DeviceDetail>>() {
  42 + @Override
  43 + public void onSuccess(APIBaseInfo baseInfo) {
  44 + if (null == getView()) {
  45 + return;
  46 + }
  47 + QMUITipDialogUtil.dismessDialog();
  48 + EventBus.getDefault().post(new EventMsg(EventMsg.DELETE_DEVICE_NAME_SUCCESS, null));
  49 + }
  50 + })
  51 + .setFailureCallback(new FailureCallback() {
  52 + @Override
  53 + public void onFailure(int i, String s) {
  54 + //显示重试
  55 + if (null == getView()) {
  56 + return;
  57 + }
  58 + QMUITipDialogUtil.dismessDialog();
  59 + QMUITipDialogUtil.failedDialog(context, s, 1);
  60 + }
  61 + })
  62 +
  63 + .start();
  64 + }
  65 +
  66 +
  67 + /**
  68 + * 获取设备信息
  69 + *
  70 + * @param context
  71 + * @param deviceId
  72 + */
23 73 public void getDeviceDetailMsg(Context context, String deviceId) {
24 74 if (null == getView()) {
25 75 return;
... ...
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/view/ChangeDeviceNameView.java
... ... @@ -8,12 +8,14 @@ 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.netWork.bean.DeviceDetail;
11 12 import com.cnlive.strike.xiaojiaspeaker.ui.activity.ChangeDeviceNameActivity;
12 13 import com.cnlive.strike.xiaojiaspeaker.ui.fragment.ChangeDeviceNameFragment;
13 14 import com.hannesdorfmann.mosby3.mvp.MvpView;
14 15  
15 16 public class ChangeDeviceNameView implements MvpView {
16 17 private ChangeDeviceNameFragment fragment;
  18 + private String deviceId;
17 19  
18 20 public ChangeDeviceNameView(ChangeDeviceNameFragment fragment) {
19 21 this.fragment = fragment;
... ... @@ -23,7 +25,8 @@ public class ChangeDeviceNameView implements MvpView {
23 25 return fragment == null ? null : fragment.getActivity();
24 26 }
25 27  
26   - public void initView() {
  28 + public void initView(String deviceId) {
  29 + this.deviceId = deviceId;
27 30 //编辑框
28 31 fragment.binding.etName.addTextChangedListener(new TextWatcher() {
29 32 @Override
... ... @@ -54,27 +57,29 @@ public class ChangeDeviceNameView implements MvpView {
54 57 fragment.binding.etName.setText("");
55 58 }
56 59 });
  60 + //设置音箱名称
  61 + fragment.binding.btnNext.setOnClickListener(new View.OnClickListener() {
  62 + @Override
  63 + public void onClick(View view) {
  64 + fragment.getPresenter().changeDeviceName(getContext(), deviceId, fragment.binding.etName.getText().toString());
  65 + }
  66 + });
57 67 }
58 68  
59 69  
60   -
61 70 /**
62 71 * 设置绑定按钮不可点击
63 72 */
64 73 private void setBtnCantClick() {
65   - if (fragment.binding.btnNext.isClickable()) {
66   - fragment.binding.btnNext.setClickable(false);
67   - fragment.binding.btnNext.setBackground(ContextCompat.getDrawable(getContext(), R.drawable.shape_btn_press));
68   - }
  74 + fragment.binding.btnNext.setClickable(false);
  75 + fragment.binding.btnNext.setBackground(ContextCompat.getDrawable(getContext(), R.drawable.shape_btn_press));
69 76 }
70 77  
71 78 /**
72 79 * 设置绑定按钮可点击
73 80 */
74 81 private void setBtnClick() {
75   - if (!fragment.binding.btnNext.isClickable()) {
76   - fragment.binding.btnNext.setClickable(true);
77   - fragment.binding.btnNext.setBackground(ContextCompat.getDrawable(getContext(), R.drawable.selector_btn_green));
78   - }
  82 + fragment.binding.btnNext.setClickable(true);
  83 + fragment.binding.btnNext.setBackground(ContextCompat.getDrawable(getContext(), R.drawable.selector_btn_green));
79 84 }
80 85 }
... ...
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/view/DeviceDetailView.java 0 → 100644
  1 +package com.cnlive.strike.xiaojiaspeaker.frame.view;
  2 +
  3 +import android.app.Activity;
  4 +import android.text.TextUtils;
  5 +import android.view.View;
  6 +
  7 +import com.cnlive.strike.xiaojiaspeaker.netWork.bean.FamilyListBean;
  8 +import com.cnlive.strike.xiaojiaspeaker.ui.activity.DeviceDetailActivity;
  9 +import com.cnlive.strike.xiaojiaspeaker.ui.activity.DeviceInstructionActivity;
  10 +import com.cnlive.strike.xiaojiaspeaker.ui.activity.DeviceManagerActivity;
  11 +import com.cnlive.strike.xiaojiaspeaker.ui.activity.UserManagerActivity;
  12 +import com.cnlive.strike.xiaojiaspeaker.ui.fragment.DeviceDetailFragment;
  13 +import com.hannesdorfmann.mosby3.mvp.MvpView;
  14 +
  15 +public class DeviceDetailView implements MvpView {
  16 + private DeviceDetailFragment fragment;
  17 + private FamilyListBean.UsersBeanX.DeviceListBean allDeviceInfo;
  18 + private String currentSelectFamilyId;
  19 +
  20 + public DeviceDetailView(DeviceDetailFragment fragment) {
  21 + this.fragment = fragment;
  22 + }
  23 +
  24 + public Activity getContext() {
  25 + return fragment == null ? null : fragment.getActivity();
  26 + }
  27 +
  28 + public void initView(FamilyListBean.UsersBeanX.DeviceListBean allDeviceInfo, String currentSelectFamilyId) {
  29 + this.currentSelectFamilyId = currentSelectFamilyId;
  30 + this.allDeviceInfo = allDeviceInfo;
  31 + //使用者管理
  32 + fragment.binding.rlUserManager.setOnClickListener(new View.OnClickListener() {
  33 + @Override
  34 + public void onClick(View view) {
  35 + if (!TextUtils.isEmpty(currentSelectFamilyId)) {
  36 + UserManagerActivity.StartActivity(getContext(), currentSelectFamilyId);
  37 + }
  38 + }
  39 + });
  40 + //设备管理
  41 + fragment.binding.rlDeviceManager.setOnClickListener(new View.OnClickListener() {
  42 + @Override
  43 + public void onClick(View view) {
  44 + DeviceManagerActivity.startActivity(getContext(), allDeviceInfo);
  45 + }
  46 + });
  47 + //设备说明
  48 + fragment.binding.rlDeviceDeclare.setOnClickListener(new View.OnClickListener() {
  49 + @Override
  50 + public void onClick(View view) {
  51 + DeviceInstructionActivity.startActivity(getContext());
  52 + }
  53 + });
  54 + }
  55 +}
... ...
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/view/DeviceManagerFragmentView.java
1 1 package com.cnlive.strike.xiaojiaspeaker.frame.view;
2 2  
3 3 import android.app.Activity;
  4 +import android.graphics.Typeface;
4 5 import android.support.v7.widget.DefaultItemAnimator;
5 6 import android.support.v7.widget.LinearLayoutManager;
  7 +import android.text.TextUtils;
6 8 import android.view.View;
7 9  
8 10 import com.cnlive.strike.xiaojiaspeaker.R;
... ... @@ -10,10 +12,12 @@ import com.cnlive.strike.xiaojiaspeaker.model.DeviceManagerMenu;
10 12 import com.cnlive.strike.xiaojiaspeaker.netWork.bean.DeviceDetail;
11 13 import com.cnlive.strike.xiaojiaspeaker.netWork.bean.FamilyListBean;
12 14 import com.cnlive.strike.xiaojiaspeaker.ui.activity.ChangeDeviceNameActivity;
  15 +import com.cnlive.strike.xiaojiaspeaker.ui.activity.DeviceInfoActivity;
13 16 import com.cnlive.strike.xiaojiaspeaker.ui.activity.DeviceManagerActivity;
14 17 import com.cnlive.strike.xiaojiaspeaker.ui.activity.FirmwareUpdateActivity;
15 18 import com.cnlive.strike.xiaojiaspeaker.ui.adapter.DeviceManagerMenuAdapter;
16 19 import com.cnlive.strike.xiaojiaspeaker.ui.fragment.DeviceManagerFragment;
  20 +import com.cnlive.strike.xiaojiaspeaker.ui.widget.SelectDialog;
17 21 import com.hannesdorfmann.mosby3.mvp.MvpView;
18 22  
19 23 import java.util.ArrayList;
... ... @@ -24,7 +28,8 @@ public class DeviceManagerFragmentView implements MvpView {
24 28 // private DeviceManagerMenuAdapter adapter;
25 29 // private List<DeviceManagerMenu> deviceManagerMenuList;
26 30 private DeviceDetail deviceDetail;
27   -private FamilyListBean.UsersBeanX.DeviceListBean currentDeviceInfo;
  31 + private FamilyListBean.UsersBeanX.DeviceListBean currentDeviceInfo;
  32 +
28 33 public DeviceManagerFragmentView(DeviceManagerFragment fragment) {
29 34 this.fragment = fragment;
30 35 }
... ... @@ -34,7 +39,7 @@ private FamilyListBean.UsersBeanX.DeviceListBean currentDeviceInfo;
34 39 }
35 40  
36 41 public void initView(FamilyListBean.UsersBeanX.DeviceListBean currentDeviceInfo) {
37   - this.currentDeviceInfo=currentDeviceInfo;
  42 + this.currentDeviceInfo = currentDeviceInfo;
38 43 // deviceManagerMenuList = new ArrayList<>();
39 44 // deviceManagerMenuList.add(new DeviceManagerMenu("音箱名称", "as", DeviceManagerMenu.NO_RIGHT_ARROW));
40 45 // deviceManagerMenuList.add(new DeviceManagerMenu("WIFI设置", "asd", DeviceManagerMenu.NORMAL));
... ... @@ -53,7 +58,7 @@ private FamilyListBean.UsersBeanX.DeviceListBean currentDeviceInfo;
53 58 fragment.binding.llDeviceName.setOnClickListener(new View.OnClickListener() {
54 59 @Override
55 60 public void onClick(View view) {
56   - ChangeDeviceNameActivity.startActivity(getContext());
  61 + ChangeDeviceNameActivity.startActivity(getContext(), currentDeviceInfo.getMcid());
57 62 }
58 63 });
59 64 //wifi设置
... ... @@ -67,26 +72,61 @@ private FamilyListBean.UsersBeanX.DeviceListBean currentDeviceInfo;
67 72 fragment.binding.llDeviceInfo.setOnClickListener(new View.OnClickListener() {
68 73 @Override
69 74 public void onClick(View view) {
70   -
  75 + DeviceInfoActivity.startActivity(getContext(), deviceDetail);
71 76 }
72 77 });
73 78 //固件升级
74 79 fragment.binding.llDeviceUpdate.setOnClickListener(new View.OnClickListener() {
75 80 @Override
76 81 public void onClick(View view) {
77   - FirmwareUpdateActivity.startActivity(getContext());
  82 + FirmwareUpdateActivity.startActivity(getContext(), deviceDetail);
  83 + }
  84 + });
  85 + //删除设备
  86 + fragment.binding.tvDeleteDevice.setOnClickListener(new View.OnClickListener() {
  87 + @Override
  88 + public void onClick(View view) {
  89 + SelectDialog selectDialog = new SelectDialog(getContext(), "删除设备后音箱将不可用\n确定删除吗?", "取消", new SelectDialog.DialogInterface() {
  90 + @Override
  91 + public void onClick(SelectDialog dialog) {
  92 + dialog.dismiss();
  93 + }
  94 + }, "删除", new SelectDialog.DialogInterface() {
  95 + @Override
  96 + public void onClick(SelectDialog dialog) {
  97 + dialog.dismiss();
  98 + if (!TextUtils.isEmpty(deviceDetail.getSN())) {
  99 + fragment.getPresenter().deleteDevice(getContext(), deviceDetail.getSN());
  100 + }
  101 + }
  102 + });
  103 + selectDialog.setCancelable(false);
  104 + selectDialog.setCanceledOnTouchOutside(false);
  105 + selectDialog.setTipTextStyle(Typeface.DEFAULT);
  106 + selectDialog.setRightBtnColor(R.color.btn_green);
  107 + if (!selectDialog.isShowing()) {
  108 + selectDialog.show();
  109 + }
78 110 }
79 111 });
80 112 }
81 113  
82   - public void initData(DeviceDetail deviceDetail){
  114 + public void initData(DeviceDetail deviceDetail) {
83 115 this.deviceDetail = deviceDetail;
84 116 //设置音箱名称
85 117 fragment.binding.tvDeviceName.setText(deviceDetail.getDeviceName());
86 118 //设置wifi
87 119 fragment.binding.tvWifiName.setText(deviceDetail.getWifiName());
88   - //设置固件版本号
89   - fragment.binding.tvCurrentVersion.setText(deviceDetail.getVer());
  120 + if (!TextUtils.isEmpty(deviceDetail.getVer())) {
  121 + String flag = "XiaoJiaSmartSpeaker_";
  122 + if (deviceDetail.getVer().indexOf("") != -1) {
  123 + //设置固件版本号
  124 + fragment.binding.tvCurrentVersion.setText(deviceDetail.getVer().substring(flag.length(), deviceDetail.getVer().length()));
  125 + } else {
  126 + fragment.binding.tvCurrentVersion.setText(deviceDetail.getVer());
  127 + }
  128 + }
  129 +
90 130 }
91 131  
92 132 /**
... ...
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/view/FirmwareUpdateFragmentView.java
1 1 package com.cnlive.strike.xiaojiaspeaker.frame.view;
2 2  
3 3 import android.app.Activity;
  4 +import android.view.View;
4 5  
  6 +import com.cnlive.libs.base.util.AlertUtil;
  7 +import com.cnlive.strike.xiaojiaspeaker.netWork.bean.DeviceDetail;
5 8 import com.cnlive.strike.xiaojiaspeaker.ui.fragment.FirmwareUpdateFragment;
6 9 import com.hannesdorfmann.mosby3.mvp.MvpView;
7 10  
... ... @@ -16,6 +19,22 @@ public class FirmwareUpdateFragmentView implements MvpView {
16 19 return fragment == null ? null : fragment.getActivity();
17 20 }
18 21  
19   - public void initView() {
  22 + public void initView(DeviceDetail deviceDetail) {
  23 + if (deviceDetail.getVer().indexOf("") != -1) {
  24 + String flag = "XiaoJiaSmartSpeaker_";
  25 + //设置固件版本号
  26 + fragment.binding.tvCurrentVersion.setText(deviceDetail.getVer().substring(flag.length(),deviceDetail.getVer().length()));
  27 + fragment.binding.tvNewVersion.setText(deviceDetail.getVer().substring(flag.length(),deviceDetail.getVer().length()));
  28 + } else {
  29 + fragment.binding.tvCurrentVersion.setText(deviceDetail.getVer());
  30 + fragment.binding.tvNewVersion.setText(deviceDetail.getVer());
  31 + }
  32 +
  33 + fragment.binding.btnCheckUpdate.setOnClickListener(new View.OnClickListener() {
  34 + @Override
  35 + public void onClick(View view) {
  36 + AlertUtil.showDeftToast(getContext(),"当前为最新版本");
  37 + }
  38 + });
20 39 }
21 40 }
... ...
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/model/message/EventMsg.java 0 → 100644
  1 +package com.cnlive.strike.xiaojiaspeaker.model.message;
  2 +
  3 +public class EventMsg {
  4 + public static final int CHANGE_DEVICE_NAME_SUCCESS = 0;//修改时设备名称成功
  5 + public static final int DELETE_DEVICE_NAME_SUCCESS = 1;//删除设备成功
  6 +
  7 + private int eventType;
  8 + private Object data;
  9 +
  10 + public EventMsg(int eventType, Object data) {
  11 + this.eventType = eventType;
  12 + this.data = data;
  13 + }
  14 +
  15 + public int getEventType() {
  16 + return eventType;
  17 + }
  18 +
  19 + public void setEventType(int eventType) {
  20 + this.eventType = eventType;
  21 + }
  22 +
  23 + public Object getData() {
  24 + return data;
  25 + }
  26 +
  27 + public void setData(Object data) {
  28 + this.data = data;
  29 + }
  30 +}
... ...
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/netWork/ApiServiceXiaoJia.java
... ... @@ -90,5 +90,15 @@ public interface ApiServiceXiaoJia {
90 90 */
91 91 @POST("/Daren/sound/updateDeviceName.action")
92 92 Observable<Result<APIBaseInfo>> changeDeviceName(@QueryMap() Map<String, String> maps);
  93 +
  94 + /**
  95 + * 删除(解绑设备)
  96 + * devId String true 设备id
  97 + *
  98 + * @param maps
  99 + * @return
  100 + */
  101 + @POST("/Daren/sound/deleteDevice.action")
  102 + Observable<Result<APIBaseInfo>> deleteDevice(@QueryMap() Map<String, String> maps);
93 103 }
94 104  
... ...
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/netWork/bean/DeviceDetail.java
1 1 package com.cnlive.strike.xiaojiaspeaker.netWork.bean;
2 2  
  3 +import java.io.Serializable;
  4 +
3 5 /**
4 6 * 设备详情页面
5 7 */
6   -public class DeviceDetail {
  8 +public class DeviceDetail implements Serializable {
7 9  
8 10 /**
9 11 * deviceName : 布丁
... ...
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/activity/ChangeDeviceNameActivity.java
... ... @@ -7,6 +7,7 @@ import android.support.v4.content.ContextCompat;
7 7 import android.support.v7.app.AppCompatActivity;
8 8 import android.os.Bundle;
9 9 import android.text.Editable;
  10 +import android.text.TextUtils;
10 11 import android.text.TextWatcher;
11 12 import android.view.View;
12 13  
... ... @@ -30,12 +31,18 @@ public class ChangeDeviceNameActivity extends AppCompatActivity {
30 31 protected void onCreate(Bundle savedInstanceState) {
31 32 super.onCreate(savedInstanceState);
32 33 binding = DataBindingUtil.setContentView(this, R.layout.activity_change_device_name);
33   - getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, ChangeDeviceNameFragment.newInstance()).commitAllowingStateLoss();
  34 + if (null!=getIntent().getExtras()){
  35 + String deviceId=getIntent().getExtras().getString("deviceId");
  36 + if (!TextUtils.isEmpty(deviceId)){
  37 + getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, ChangeDeviceNameFragment.newInstance(deviceId)).commitAllowingStateLoss();
  38 + }
  39 + }
34 40  
35 41 }
36 42  
37   - public static void startActivity(Activity activity) {
  43 + public static void startActivity(Activity activity,String deviceId) {
38 44 Intent intent = new Intent(activity, ChangeDeviceNameActivity.class);
  45 + intent.putExtra("deviceId",deviceId);
39 46 activity.startActivity(intent);
40 47 }
41 48  
... ...
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/activity/DeviceDetailActivity.java
... ... @@ -13,7 +13,14 @@ import com.cnlive.libs.base.util.StatusBarUtil;
13 13 import com.cnlive.libs.base.util.StatusBarUtil2;
14 14 import com.cnlive.strike.xiaojiaspeaker.R;
15 15 import com.cnlive.strike.xiaojiaspeaker.databinding.ActivityDeviceDetailBinding;
  16 +import com.cnlive.strike.xiaojiaspeaker.model.message.EventMsg;
16 17 import com.cnlive.strike.xiaojiaspeaker.netWork.bean.FamilyListBean;
  18 +import com.cnlive.strike.xiaojiaspeaker.ui.fragment.DeviceDetailFragment;
  19 +import com.cnlive.strike.xiaojiaspeaker.ui.fragment.DeviceManagerFragment;
  20 +import com.cnlive.strike.xiaojiaspeaker.util.EventBusUtil;
  21 +
  22 +import org.greenrobot.eventbus.Subscribe;
  23 +import org.greenrobot.eventbus.ThreadMode;
17 24  
18 25 import java.io.Serializable;
19 26  
... ... @@ -22,67 +29,24 @@ import java.io.Serializable;
22 29 */
23 30 public class DeviceDetailActivity extends AppCompatActivity {
24 31 private ActivityDeviceDetailBinding binding;
25   - private FamilyListBean.UsersBeanX.DeviceListBean allDeviceInfo;
26 32  
27 33 @Override
28 34 protected void onCreate(Bundle savedInstanceState) {
29 35 super.onCreate(savedInstanceState);
30 36 binding = DataBindingUtil.setContentView(this, R.layout.activity_device_detail);
31 37 if (null != getIntent().getExtras()) {
32   - allDeviceInfo = (FamilyListBean.UsersBeanX.DeviceListBean) getIntent().getExtras().getSerializable("allDeviceInfo");
33   - if (null != allDeviceInfo) {
34   - initTopBar(allDeviceInfo.getName());
35   - }
36   - }
37   - if (null != getIntent().getExtras()) {
  38 + FamilyListBean.UsersBeanX.DeviceListBean allDeviceInfo = (FamilyListBean.UsersBeanX.DeviceListBean) getIntent().getExtras().getSerializable("allDeviceInfo");
38 39 String currentSelectFamilyId = getIntent().getExtras().getString("currentSelectFamilyId");
39   - if (!TextUtils.isEmpty(currentSelectFamilyId)) {
40   - initView(currentSelectFamilyId);
41   - }
42   - }
43   - }
  40 + if (null != allDeviceInfo && !TextUtils.isEmpty(currentSelectFamilyId)) {
  41 + getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, DeviceDetailFragment.newInstance(allDeviceInfo, currentSelectFamilyId)).commitAllowingStateLoss();
44 42  
45   - private void initView(String currentSelectFamilyId) {
46   - //使用者管理
47   - binding.rlUserManager.setOnClickListener(new View.OnClickListener() {
48   - @Override
49   - public void onClick(View view) {
50   - if (!TextUtils.isEmpty(currentSelectFamilyId)) {
51   - UserManagerActivity.StartActivity(DeviceDetailActivity.this, currentSelectFamilyId);
52   - }
53   - }
54   - });
55   - //设备管理
56   - binding.rlDeviceManager.setOnClickListener(new View.OnClickListener() {
57   - @Override
58   - public void onClick(View view) {
59   - DeviceManagerActivity.startActivity(DeviceDetailActivity.this,allDeviceInfo);
60   - }
61   - });
62   - //设备说明
63   - binding.rlDeviceDeclare.setOnClickListener(new View.OnClickListener() {
64   - @Override
65   - public void onClick(View view) {
66   - DeviceInstructionActivity.startActivity(DeviceDetailActivity.this);
67 43 }
68   - });
69   - }
70 44  
71   - private void initTopBar(String deviceName) {
72   - StatusBarUtil.setStatusBarWrite(this);
73   - StatusBarUtil2.setColor(this, ContextCompat.getColor(this, R.color.white), 0);
74   - if (null != binding) {
75   - binding.topbar.setTitle(deviceName);
76   - //设置返回按钮
77   - binding.topbar.addLeftImageButton(R.drawable.icon_back, R.id.left_back).setOnClickListener(new View.OnClickListener() {
78   - @Override
79   - public void onClick(View view) {
80   - finish();
81   - }
82   - });
83 45 }
  46 +
84 47 }
85 48  
  49 +
86 50 public static void startActivity(Activity activity, FamilyListBean.UsersBeanX.DeviceListBean allDeviceInfo, String currentSelectFamilyId) {
87 51 Intent intent = new Intent(activity, DeviceDetailActivity.class);
88 52 intent.putExtra("allDeviceInfo", (Serializable) allDeviceInfo);
... ...
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/activity/DeviceInfoActivity.java 0 → 100644
  1 +package com.cnlive.strike.xiaojiaspeaker.ui.activity;
  2 +
  3 +import android.app.Activity;
  4 +import android.content.Intent;
  5 +import android.databinding.DataBindingUtil;
  6 +import android.support.v4.content.ContextCompat;
  7 +import android.support.v7.app.AppCompatActivity;
  8 +import android.os.Bundle;
  9 +import android.view.View;
  10 +
  11 +import com.cnlive.libs.base.util.StatusBarUtil;
  12 +import com.cnlive.libs.base.util.StatusBarUtil2;
  13 +import com.cnlive.strike.xiaojiaspeaker.R;
  14 +import com.cnlive.strike.xiaojiaspeaker.databinding.ActivityDeviceInfoBinding;
  15 +import com.cnlive.strike.xiaojiaspeaker.netWork.bean.DeviceDetail;
  16 +
  17 +/**
  18 + * 设备信息
  19 + */
  20 +public class DeviceInfoActivity extends AppCompatActivity {
  21 + private ActivityDeviceInfoBinding binding;
  22 +
  23 + @Override
  24 + protected void onCreate(Bundle savedInstanceState) {
  25 + super.onCreate(savedInstanceState);
  26 + binding = DataBindingUtil.setContentView(this, R.layout.activity_device_info);
  27 + initTopBar();
  28 + if (null != getIntent().getExtras()) {
  29 + DeviceDetail deviceDetail = (DeviceDetail) getIntent().getExtras().getSerializable("deviceDetail");
  30 + if (null != deviceDetail) {
  31 + initView(deviceDetail.getIP(), deviceDetail.getMAC(), deviceDetail.getSN());
  32 + }
  33 + }
  34 + }
  35 +
  36 + private void initView(String ip, String mac, String sn) {
  37 + binding.tvIpAddr.setText(ip);
  38 + binding.tvMacAddr.setText(mac);
  39 + binding.tvSn.setText(sn);
  40 + }
  41 +
  42 + private void initTopBar() {
  43 + StatusBarUtil.setStatusBarWrite(this);
  44 + StatusBarUtil2.setColor(this, ContextCompat.getColor(this, R.color.white), 0);
  45 + if (null != binding) {
  46 + binding.topbar.setTitle("设备信息");
  47 + //设置返回按钮
  48 + binding.topbar.addLeftImageButton(R.drawable.icon_back, R.id.left_back).setOnClickListener(new View.OnClickListener() {
  49 + @Override
  50 + public void onClick(View view) {
  51 + finish();
  52 + }
  53 + });
  54 + }
  55 + }
  56 +
  57 + public static void startActivity(Activity activity, DeviceDetail deviceDetail) {
  58 + Intent intent = new Intent(activity, DeviceInfoActivity.class);
  59 + intent.putExtra("deviceDetail", deviceDetail);
  60 + activity.startActivity(intent);
  61 + }
  62 +}
... ...
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/activity/FirmwareUpdateActivity.java
... ... @@ -7,6 +7,7 @@ import android.os.Bundle;
7 7  
8 8 import com.cnlive.strike.xiaojiaspeaker.R;
9 9 import com.cnlive.strike.xiaojiaspeaker.databinding.FragmentFirmwareUpdateBinding;
  10 +import com.cnlive.strike.xiaojiaspeaker.netWork.bean.DeviceDetail;
10 11 import com.cnlive.strike.xiaojiaspeaker.ui.fragment.DeviceManagerFragment;
11 12 import com.cnlive.strike.xiaojiaspeaker.ui.fragment.FirmwareUpdateFragment;
12 13  
... ... @@ -19,11 +20,16 @@ public class FirmwareUpdateActivity extends AppCompatActivity {
19 20 protected void onCreate(Bundle savedInstanceState) {
20 21 super.onCreate(savedInstanceState);
21 22 setContentView(R.layout.activity_search_device);
22   - getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, FirmwareUpdateFragment.newInstance()).commitAllowingStateLoss();
23   -
  23 + if (null!=getIntent().getExtras()){
  24 + DeviceDetail deviceDetail= (DeviceDetail) getIntent().getExtras().getSerializable("deviceDetail");
  25 + getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, FirmwareUpdateFragment.newInstance(deviceDetail)).commitAllowingStateLoss();
  26 + }
24 27 }
25 28  
26   - public static void startActivity(Activity activity) {
27   - activity.startActivity(new Intent(activity, FirmwareUpdateActivity.class));
  29 +
  30 + public static void startActivity(Activity activity, DeviceDetail deviceDetail) {
  31 + Intent intent = new Intent(activity, FirmwareUpdateActivity.class);
  32 + intent.putExtra("deviceDetail", deviceDetail);
  33 + activity.startActivity(intent);
28 34 }
29 35 }
... ...
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/fragment/AllDeviceFragment.java
... ... @@ -15,11 +15,17 @@ import com.cnlive.strike.xiaojiaspeaker.commonInfo.XiaoJIaCommInfo;
15 15 import com.cnlive.strike.xiaojiaspeaker.databinding.FragmentAllDeviceBinding;
16 16 import com.cnlive.strike.xiaojiaspeaker.frame.presenter.AllDeviceFragmentPresenter;
17 17 import com.cnlive.strike.xiaojiaspeaker.frame.view.AllDeviceFragmentView;
  18 +import com.cnlive.strike.xiaojiaspeaker.model.message.EventMsg;
18 19 import com.cnlive.strike.xiaojiaspeaker.ui.activity.BlueToothStep1Activity;
19 20 import com.cnlive.strike.xiaojiaspeaker.ui.widget.popmenu.PopMenuInfo;
20 21 import com.cnlive.strike.xiaojiaspeaker.ui.widget.popmenu.PopMenu;
  22 +import com.cnlive.strike.xiaojiaspeaker.util.EventBusUtil;
21 23 import com.qmuiteam.qmui.alpha.QMUIAlphaImageButton;
22 24  
  25 +import org.greenrobot.eventbus.EventBus;
  26 +import org.greenrobot.eventbus.Subscribe;
  27 +import org.greenrobot.eventbus.ThreadMode;
  28 +
23 29 import java.util.ArrayList;
24 30 import java.util.List;
25 31  
... ... @@ -46,13 +52,34 @@ public class AllDeviceFragment extends MvpBindingFragment&lt;AllDeviceFragmentView,
46 52 @Override
47 53 public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
48 54 super.onViewCreated(view, savedInstanceState);
  55 + EventBusUtil.register(this);
49 56 initTopBar();
50 57 if (null != getMvpView()) {
51 58 getMvpView().initView();
52 59 getPresenter().getFamilyList(getActivity(), XiaoJIaCommInfo.getUserId(getActivity()), XiaoJIaCommInfo.getUserPhone(getActivity()));
53 60 }
  61 +
  62 + }
  63 +
  64 + @Override
  65 + public void onDestroy() {
  66 + super.onDestroy();
  67 + EventBusUtil.unRegister(this);
  68 +
54 69 }
55 70  
  71 + @Subscribe(threadMode = ThreadMode.MAIN)
  72 + public void event(EventMsg msg) {
  73 + if (EventMsg.CHANGE_DEVICE_NAME_SUCCESS == msg.getEventType()) {
  74 + if (null != getMvpView()) {
  75 + getPresenter().getFamilyList(getActivity(), XiaoJIaCommInfo.getUserId(getActivity()), XiaoJIaCommInfo.getUserPhone(getActivity()));
  76 + }
  77 + } else if (EventMsg.DELETE_DEVICE_NAME_SUCCESS == msg.getEventType()) {
  78 + getPresenter().getFamilyList(getActivity(), XiaoJIaCommInfo.getUserId(getActivity()), XiaoJIaCommInfo.getUserPhone(getActivity()));
  79 + }
  80 + }
  81 +
  82 +
56 83 private void initTopBar() {
57 84 StatusBarUtil.setStatusBarWrite(getActivity());
58 85 StatusBarUtil2.setColor(getActivity(), ContextCompat.getColor(getActivity(), R.color.white), 0);
... ...
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/fragment/ChangeDeviceNameFragment.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;
... ... @@ -12,10 +13,14 @@ import com.cnlive.strike.xiaojiaspeaker.R;
12 13 import com.cnlive.strike.xiaojiaspeaker.databinding.FragmentChangeDeviceNameBinding;
13 14 import com.cnlive.strike.xiaojiaspeaker.frame.presenter.ChangeDeviceNamePresenter;
14 15 import com.cnlive.strike.xiaojiaspeaker.frame.view.ChangeDeviceNameView;
  16 +import com.cnlive.strike.xiaojiaspeaker.netWork.bean.DeviceDetail;
15 17  
16 18 public class ChangeDeviceNameFragment extends MvpBindingFragment<ChangeDeviceNameView, ChangeDeviceNamePresenter, Object, FragmentChangeDeviceNameBinding> {
17   - public static ChangeDeviceNameFragment newInstance() {
  19 + public static ChangeDeviceNameFragment newInstance(String deviceId) {
18 20 ChangeDeviceNameFragment fragment = new ChangeDeviceNameFragment();
  21 + Bundle bundle = new Bundle();
  22 + bundle.putString("deviceId",deviceId);
  23 + fragment.setArguments(bundle);
19 24 return fragment;
20 25 }
21 26  
... ... @@ -35,7 +40,12 @@ public class ChangeDeviceNameFragment extends MvpBindingFragment&lt;ChangeDeviceNam
35 40 super.onViewCreated(view, savedInstanceState);
36 41 initTopBar();
37 42 if (null != getMvpView()) {
38   - getMvpView().initView();
  43 + if (null != getArguments()) {
  44 + String deviceId= getArguments().getString("deviceId");
  45 + if (!TextUtils.isEmpty(deviceId)) {
  46 + getMvpView().initView(deviceId);
  47 + }
  48 + }
39 49 }
40 50 }
41 51  
... ...
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/fragment/DeviceDetailFragment.java 0 → 100644
  1 +package com.cnlive.strike.xiaojiaspeaker.ui.fragment;
  2 +
  3 +import android.os.Bundle;
  4 +import android.support.annotation.Nullable;
  5 +import android.support.v4.content.ContextCompat;
  6 +import android.view.View;
  7 +
  8 +import com.cnlive.libs.base.frame.fragment.MvpBindingFragment;
  9 +import com.cnlive.libs.base.util.StatusBarUtil;
  10 +import com.cnlive.libs.base.util.StatusBarUtil2;
  11 +import com.cnlive.strike.xiaojiaspeaker.R;
  12 +import com.cnlive.strike.xiaojiaspeaker.databinding.FragmentDeviceDetailBinding;
  13 +import com.cnlive.strike.xiaojiaspeaker.frame.presenter.DeviceDetailPresenter;
  14 +import com.cnlive.strike.xiaojiaspeaker.frame.view.DeviceDetailView;
  15 +import com.cnlive.strike.xiaojiaspeaker.model.message.EventMsg;
  16 +import com.cnlive.strike.xiaojiaspeaker.netWork.bean.FamilyListBean;
  17 +import com.cnlive.strike.xiaojiaspeaker.util.EventBusUtil;
  18 +
  19 +import org.greenrobot.eventbus.Subscribe;
  20 +import org.greenrobot.eventbus.ThreadMode;
  21 +
  22 +public class DeviceDetailFragment extends MvpBindingFragment<DeviceDetailView, DeviceDetailPresenter, Object, FragmentDeviceDetailBinding> {
  23 + public static DeviceDetailFragment newInstance(FamilyListBean.UsersBeanX.DeviceListBean allDeviceInfo, String currentSelectFamilyId) {
  24 + DeviceDetailFragment fragment = new DeviceDetailFragment();
  25 + Bundle bundle = new Bundle();
  26 + bundle.putSerializable("allDeviceInfo", allDeviceInfo);
  27 + bundle.putString("currentSelectFamilyId", currentSelectFamilyId);
  28 + fragment.setArguments(bundle);
  29 + return fragment;
  30 + }
  31 +
  32 + @Override
  33 + public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
  34 + super.onViewCreated(view, savedInstanceState);
  35 + EventBusUtil.register(this);
  36 + if (null != getArguments()) {
  37 + FamilyListBean.UsersBeanX.DeviceListBean allDeviceInfo = (FamilyListBean.UsersBeanX.DeviceListBean) getArguments().getSerializable("allDeviceInfo");
  38 + String currentSelectFamilyId = getArguments().getString("currentSelectFamilyId");
  39 + if (null != getMvpView()) {
  40 + initTopBar(allDeviceInfo.getName());
  41 + getMvpView().initView(allDeviceInfo,currentSelectFamilyId);
  42 + }
  43 + }
  44 + }
  45 +
  46 + @Override
  47 + protected int getLayoutId() {
  48 + return R.layout.fragment_device_detail;
  49 + }
  50 +
  51 + private void initTopBar(String deviceName) {
  52 + StatusBarUtil.setStatusBarWrite(getActivity());
  53 + StatusBarUtil2.setColor(getActivity(), ContextCompat.getColor(getActivity(), R.color.white), 0);
  54 + if (null != binding) {
  55 + binding.topbar.setTitle(deviceName);
  56 + //设置返回按钮
  57 + binding.topbar.addLeftImageButton(R.drawable.icon_back, R.id.left_back).setOnClickListener(new View.OnClickListener() {
  58 + @Override
  59 + public void onClick(View view) {
  60 + getActivity().finish();
  61 + }
  62 + });
  63 + }
  64 + }
  65 +
  66 + @Override
  67 + public void onDestroy() {
  68 + super.onDestroy();
  69 + EventBusUtil.unRegister(this);
  70 +
  71 + }
  72 +
  73 + @Subscribe(threadMode = ThreadMode.MAIN)
  74 + public void event(EventMsg msg) {
  75 + if (EventMsg.DELETE_DEVICE_NAME_SUCCESS == msg.getEventType()) {
  76 + getActivity().finish();
  77 + }
  78 + }
  79 +
  80 +}
... ...
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/fragment/DeviceManagerFragment.java
... ... @@ -10,10 +10,16 @@ import com.cnlive.libs.base.frame.fragment.MvpBindingFragment;
10 10 import com.cnlive.libs.base.util.StatusBarUtil;
11 11 import com.cnlive.libs.base.util.StatusBarUtil2;
12 12 import com.cnlive.strike.xiaojiaspeaker.R;
  13 +import com.cnlive.strike.xiaojiaspeaker.commonInfo.XiaoJIaCommInfo;
13 14 import com.cnlive.strike.xiaojiaspeaker.databinding.FragmentDeviceManagerBinding;
14 15 import com.cnlive.strike.xiaojiaspeaker.frame.presenter.DeviceManagerFragmentPresenter;
15 16 import com.cnlive.strike.xiaojiaspeaker.frame.view.DeviceManagerFragmentView;
  17 +import com.cnlive.strike.xiaojiaspeaker.model.message.EventMsg;
16 18 import com.cnlive.strike.xiaojiaspeaker.netWork.bean.FamilyListBean;
  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 * 设备管理
... ... @@ -21,11 +27,12 @@ import com.cnlive.strike.xiaojiaspeaker.netWork.bean.FamilyListBean;
21 27 * @author ys
22 28 */
23 29 public class DeviceManagerFragment extends MvpBindingFragment<DeviceManagerFragmentView, DeviceManagerFragmentPresenter, Object, FragmentDeviceManagerBinding> {
  30 + private FamilyListBean.UsersBeanX.DeviceListBean currentDeviceInfo;
24 31  
25 32 public static DeviceManagerFragment newInstance(FamilyListBean.UsersBeanX.DeviceListBean currentDeviceInfo) {
26 33 DeviceManagerFragment fragment = new DeviceManagerFragment();
27   - Bundle bundle=new Bundle();
28   - bundle.putSerializable("currentDeviceInfo",currentDeviceInfo);
  34 + Bundle bundle = new Bundle();
  35 + bundle.putSerializable("currentDeviceInfo", currentDeviceInfo);
29 36 fragment.setArguments(bundle);
30 37 return fragment;
31 38 }
... ... @@ -45,15 +52,37 @@ public class DeviceManagerFragment extends MvpBindingFragment&lt;DeviceManagerFragm
45 52 @Override
46 53 public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
47 54 super.onViewCreated(view, savedInstanceState);
  55 + EventBusUtil.register(this);
48 56 initTopBar();
49 57 if (null != getMvpView()) {
50   - if (null!=getArguments()){
51   - FamilyListBean.UsersBeanX.DeviceListBean currentDeviceInfo= (FamilyListBean.UsersBeanX.DeviceListBean) getArguments().getSerializable("currentDeviceInfo");
52   - if (null!=currentDeviceInfo&&!TextUtils.isEmpty(currentDeviceInfo.getMcid())){
  58 + if (null != getArguments()) {
  59 + currentDeviceInfo = (FamilyListBean.UsersBeanX.DeviceListBean) getArguments().getSerializable("currentDeviceInfo");
  60 + if (null != currentDeviceInfo && !TextUtils.isEmpty(currentDeviceInfo.getMcid())) {
53 61 getMvpView().initView(currentDeviceInfo);
54   - getPresenter().getDeviceDetailMsg(getActivity(),currentDeviceInfo.getMcid());
  62 + getPresenter().getDeviceDetailMsg(getActivity(), currentDeviceInfo.getMcid());
  63 + }
  64 + }
  65 + }
  66 + }
  67 +
  68 + @Override
  69 + public void onDestroy() {
  70 + super.onDestroy();
  71 + EventBusUtil.unRegister(this);
  72 + }
  73 +
  74 + @Subscribe(threadMode = ThreadMode.MAIN)
  75 + public void event(EventMsg msg) {
  76 + if (EventMsg.CHANGE_DEVICE_NAME_SUCCESS == msg.getEventType()) {
  77 + if (null != getMvpView()) {
  78 + if (null != currentDeviceInfo && !TextUtils.isEmpty(currentDeviceInfo.getMcid())) {
  79 + getPresenter().getDeviceDetailMsg(getActivity(), currentDeviceInfo.getMcid());
55 80 }
56 81 }
  82 + } else if (EventMsg.DELETE_DEVICE_NAME_SUCCESS == msg.getEventType()) {
  83 + if (null != getMvpView()) {
  84 + getActivity().finish();
  85 + }
57 86 }
58 87 }
59 88  
... ...
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/fragment/FirmwareUpdateFragment.java
... ... @@ -12,13 +12,17 @@ import com.cnlive.strike.xiaojiaspeaker.R;
12 12 import com.cnlive.strike.xiaojiaspeaker.databinding.FragmentFirmwareUpdateBinding;
13 13 import com.cnlive.strike.xiaojiaspeaker.frame.presenter.FirmwareUpdateFragmentPresenter;
14 14 import com.cnlive.strike.xiaojiaspeaker.frame.view.FirmwareUpdateFragmentView;
  15 +import com.cnlive.strike.xiaojiaspeaker.netWork.bean.DeviceDetail;
15 16  
16 17 /**
17 18 * 固件升级
18 19 */
19 20 public class FirmwareUpdateFragment extends MvpBindingFragment<FirmwareUpdateFragmentView, FirmwareUpdateFragmentPresenter, Object, FragmentFirmwareUpdateBinding> {
20   - public static FirmwareUpdateFragment newInstance() {
  21 + public static FirmwareUpdateFragment newInstance(DeviceDetail deviceDetail) {
21 22 FirmwareUpdateFragment fragment = new FirmwareUpdateFragment();
  23 + Bundle bundle = new Bundle();
  24 + bundle.putSerializable("deviceDetail", deviceDetail);
  25 + fragment.setArguments(bundle);
22 26 return fragment;
23 27 }
24 28  
... ... @@ -39,7 +43,14 @@ public class FirmwareUpdateFragment extends MvpBindingFragment&lt;FirmwareUpdateFra
39 43 super.onViewCreated(view, savedInstanceState);
40 44 initTopBar();
41 45 if (null != getMvpView()) {
42   - getMvpView().initView();
  46 + if (null != getArguments()) {
  47 + DeviceDetail deviceDetail = (DeviceDetail) getArguments().getSerializable("deviceDetail");
  48 + if (null!=deviceDetail){
  49 + getMvpView().initView(deviceDetail);
  50 + }
  51 + }
  52 +
  53 +
43 54 }
44 55 }
45 56  
... ...
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/util/EventBusUtil.java 0 → 100644
  1 +package com.cnlive.strike.xiaojiaspeaker.util;
  2 +
  3 +import android.app.Activity;
  4 +import android.support.v4.app.Fragment;
  5 +
  6 +import org.greenrobot.eventbus.EventBus;
  7 +
  8 +/**
  9 + * @author ys
  10 + */
  11 +public class EventBusUtil {
  12 + public static void register(Activity activity) {
  13 + if (!EventBus.getDefault().isRegistered(activity)) {
  14 + EventBus.getDefault().register(activity);
  15 + }
  16 + }
  17 +
  18 + public static void register(Fragment fragment) {
  19 + if (!EventBus.getDefault().isRegistered(fragment)) {
  20 + EventBus.getDefault().register(fragment);
  21 + }
  22 + }
  23 +
  24 + public static void unRegister(Activity activity) {
  25 + if (EventBus.getDefault().isRegistered(activity)) {
  26 + EventBus.getDefault().unregister(activity);
  27 + }
  28 + }
  29 +
  30 + public static void unRegister(Fragment fragment) {
  31 + if (EventBus.getDefault().isRegistered(fragment)) {
  32 + EventBus.getDefault().unregister(fragment);
  33 + }
  34 + }
  35 +
  36 +
  37 +}
... ...
module_xiaojiaSoundBox/src/main/res/layout/activity_conn_bluetooth_success.xml
... ... @@ -45,9 +45,11 @@
45 45 android:layout_width="match_parent"
46 46 android:layout_height="0dp"
47 47 android:layout_weight="1"
  48 + android:gravity="center"
48 49 android:orientation="vertical">
  50 +
49 51 <Button
50   - android:id="@+id/btn_next"
  52 + android:id="@+id/btn_invit_friend"
51 53 android:layout_width="250dp"
52 54 android:layout_height="40dp"
53 55 android:layout_alignParentBottom="true"
... ... @@ -60,38 +62,27 @@
60 62 android:textStyle="bold" />
61 63  
62 64 <Button
  65 + android:id="@+id/btn_finish"
63 66 android:layout_width="250dp"
64 67 android:layout_height="40dp"
65   - android:background="@drawable/shape_green_stroke"
66 68 android:layout_gravity="center_horizontal"
67 69 android:layout_marginTop="30dp"
68   - android:textSize="18sp"
  70 + android:background="@drawable/shape_green_stroke"
69 71 android:text="完成"
70   - android:textColor="@color/btn_green"/>
  72 + android:textColor="@color/btn_green"
  73 + android:textSize="18sp" />
71 74  
72 75 <TextView
  76 + android:id="@+id/tv_set_device_name"
73 77 android:layout_width="216dp"
74 78 android:layout_height="wrap_content"
75 79 android:layout_gravity="center_horizontal"
76   - android:layout_marginLeft="20dp"
77 80 android:layout_marginTop="30sp"
78   - android:background="@drawable/pop_gray_right"
79 81 android:gravity="center"
80   - android:text="@string/xiaojia_say_story_tip"
81   - android:textColor="@color/white"
82   - android:textSize="12sp" />
  82 + android:text="给音箱取个名字吧 >>"
  83 + android:textColor="@color/btn_green"
  84 + android:textSize="13sp" />
83 85  
84   - <TextView
85   - android:layout_width="216dp"
86   - android:layout_height="wrap_content"
87   - android:layout_gravity="center_horizontal"
88   - android:layout_marginTop="20sp"
89   - android:layout_marginRight="30dp"
90   - android:background="@drawable/pop_gray_left"
91   - android:gravity="center"
92   - android:text="@string/xiaojia_listen_to_music_tip"
93   - android:textColor="@color/white"
94   - android:textSize="12sp" />
95 86 </LinearLayout>
96 87  
97 88 <LinearLayout
... ... @@ -133,9 +124,9 @@
133 124 android:id="@+id/ll_gift_black"
134 125 android:layout_width="match_parent"
135 126 android:layout_height="match_parent"
  127 + android:background="#80000000"
136 128 android:orientation="vertical"
137   - android:visibility="gone"
138   - android:background="#80000000"></LinearLayout>
  129 + android:visibility="gone"></LinearLayout>
139 130  
140 131 <LinearLayout
141 132 android:id="@+id/ll_gift"
... ... @@ -143,8 +134,8 @@
143 134 android:layout_height="match_parent"
144 135 android:clickable="true"
145 136 android:gravity="center"
146   - android:visibility="gone"
147   - android:orientation="vertical">
  137 + android:orientation="vertical"
  138 + android:visibility="gone">
148 139  
149 140 <ImageView
150 141 android:layout_width="370dp"
... ...
module_xiaojiaSoundBox/src/main/res/layout/activity_device_detail.xml
1 1 <?xml version="1.0" encoding="utf-8"?>
2   -<layout xmlns:android="http://schemas.android.com/apk/res/android"
3   - xmlns:app="http://schemas.android.com/apk/res-auto">
  2 +<layout>
4 3  
5   - <LinearLayout
  4 + <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  5 + xmlns:app="http://schemas.android.com/apk/res-auto"
  6 + xmlns:tools="http://schemas.android.com/tools"
6 7 android:layout_width="match_parent"
7 8 android:layout_height="match_parent"
8   - android:background="@color/color_F2F2F2"
9   - android:orientation="vertical">
  9 + tools:context=".ui.activity.SearchDeviceActivity">
10 10  
11   - <com.qmuiteam.qmui.widget.QMUITopBar
12   - android:id="@+id/topbar"
13   - android:layout_width="match_parent"
14   - android:layout_height="?attr/qmui_topbar_height" />
15   - <!--远程控制-->
16   - <LinearLayout
17   - android:layout_width="match_parent"
18   - android:layout_height="90dp"
19   - android:layout_margin="10dp"
20   - android:background="@drawable/shape_10_radius_white_bg"
21   - android:clickable="true"
22   - android:orientation="vertical">
23   -
24   - <LinearLayout
25   - android:layout_width="match_parent"
26   - android:layout_height="wrap_content"
27   - android:layout_marginTop="20dp"
28   - android:gravity="center_vertical">
29   -
30   - <TextView
31   - android:id="@+id/tv_menu_title"
32   - android:layout_width="0dp"
33   - android:layout_height="wrap_content"
34   - android:layout_marginLeft="10dp"
35   - android:layout_marginRight="10dp"
36   - android:layout_weight="1"
37   - android:maxLines="1"
38   - android:text="远程控制"
39   - android:textColor="@color/color_282828"
40   - android:textSize="16sp" />
41   -
42   - <com.cnlive.strike.xiaojiaspeaker.ui.widget.switchbutton.SwitchButton
43   - android:id="@+id/sb_switch"
44   - android:layout_width="wrap_content"
45   - android:layout_height="wrap_content"
46   - android:layout_gravity="right"
47   - android:layout_marginRight="10dp"
48   - app:kswBackDrawable="@drawable/miui_back_drawable"
49   - app:kswThumbDrawable="@drawable/miui_thumb_drawable"
50   - app:kswThumbHeight="20dp"
51   - app:kswThumbRangeRatio="2.1"
52   - app:kswThumbWidth="20dp" />
53   - </LinearLayout>
54   -
55   - <TextView
56   - android:id="@+id/tv_menu_detail"
57   - android:layout_width="wrap_content"
58   - android:layout_height="wrap_content"
59   - android:layout_centerVertical="true"
60   - android:layout_marginLeft="10dp"
61   - android:layout_marginTop="10dp"
62   - android:layout_marginRight="10dp"
63   - android:layout_marginBottom="20dp"
64   - android:layout_toEndOf="@id/iv_right"
65   - android:layout_toRightOf="@id/tv_menu_title"
66   - android:gravity="center|right"
67   - android:maxLines="1"
68   - android:text="手机可远程控制音箱播放的内容,但仅限听见中国"
69   - android:textColor="@color/color_C3C3C3"
70   - android:textSize="14sp" />
71 11  
72   - </LinearLayout>
73   - <!-- -->
74   - <LinearLayout
  12 + <RelativeLayout
  13 + android:id="@+id/fragment_container"
75 14 android:layout_width="match_parent"
76   - android:layout_height="wrap_content"
77   - android:layout_margin="10dp"
78   - android:background="@drawable/shape_10_radius_white_bg"
79   - android:orientation="vertical">
80   - <!--使用者管理-->
81   - <LinearLayout
82   - android:layout_width="match_parent"
83   - android:layout_height="wrap_content"
84   - android:orientation="vertical">
85   -
86   - <RelativeLayout
87   - android:id="@+id/rl_user_manager"
88   - android:layout_width="match_parent"
89   - android:layout_height="60dp"
90   - android:clickable="true">
91   -
92   - <ImageView
93   - android:id="@+id/iv_user_manager"
94   - android:layout_width="29dp"
95   - android:layout_height="29dp"
96   - android:layout_centerVertical="true"
97   - android:layout_marginLeft="10dp"
98   - android:background="@drawable/icon_user_manager" />
99   -
100   - <TextView
101   - android:layout_width="wrap_content"
102   - android:layout_height="wrap_content"
103   - android:layout_centerVertical="true"
104   - android:layout_marginLeft="10dp"
105   - android:layout_toRightOf="@id/iv_user_manager"
106   - android:text="使用者管理"
107   - android:textColor="@color/color_282828" />
108   -
109   - <ImageView
110   - android:layout_width="7dp"
111   - android:layout_height="13dp"
112   - android:layout_alignParentRight="true"
113   - android:layout_centerVertical="true"
114   - android:layout_marginRight="10dp"
115   - android:background="@drawable/icon_item_right_arrow" />
116   - </RelativeLayout>
117   -
118   - <View
119   - android:layout_width="match_parent"
120   - android:layout_height="1dp"
121   - android:layout_marginLeft="10dp"
122   - android:layout_marginRight="10dp"
123   - android:background="@color/line" />
124   - </LinearLayout>
125   -
126   -
127   - <!--设备管理-->
128   - <RelativeLayout
129   - android:id="@+id/rl_device_manager"
130   - android:layout_width="match_parent"
131   - android:layout_height="60dp"
132   - android:clickable="true">
133   -
134   - <ImageView
135   - android:id="@+id/iv_device_manager"
136   - android:layout_width="21dp"
137   - android:layout_height="21dp"
138   - android:layout_centerVertical="true"
139   - android:layout_marginLeft="13dp"
140   - android:background="@drawable/icon_device_manager" />
141   -
142   - <TextView
143   - android:layout_width="wrap_content"
144   - android:layout_height="wrap_content"
145   - android:layout_centerVertical="true"
146   - android:layout_marginLeft="15dp"
147   - android:layout_toRightOf="@id/iv_device_manager"
148   - android:text="设备管理"
149   - android:textColor="@color/color_282828" />
150   -
151   - <View
152   - android:layout_width="9dp"
153   - android:layout_height="9dp"
154   - android:layout_centerVertical="true"
155   - android:layout_marginRight="10dp"
156   - android:layout_toLeftOf="@id/iv_device_manager_continue"
157   - android:background="@drawable/shape_red_circle" />
158   -
159   - <ImageView
160   - android:id="@+id/iv_device_manager_continue"
161   - android:layout_width="wrap_content"
162   - android:layout_height="wrap_content"
163   - android:layout_alignParentRight="true"
164   - android:layout_centerVertical="true"
165   - android:layout_marginRight="10dp"
166   - android:background="@drawable/icon_item_right_arrow" />
167   - </RelativeLayout>
168   -
169   - <View
170   - android:layout_width="match_parent"
171   - android:layout_height="1dp"
172   - android:layout_marginLeft="10dp"
173   - android:layout_marginRight="10dp"
174   - android:background="@color/line" />
175   - <!--设备说明-->
176   - <RelativeLayout
177   - android:id="@+id/rl_device_declare"
178   - android:layout_width="match_parent"
179   - android:layout_height="60dp"
180   - android:clickable="true">
181   -
182   - <ImageView
183   - android:id="@+id/iv_device_declare"
184   - android:layout_width="23dp"
185   - android:layout_height="23dp"
186   - android:layout_centerVertical="true"
187   - android:layout_marginLeft="13dp"
188   - android:background="@drawable/icon_device_declare" />
189   -
190   - <TextView
191   - android:layout_width="wrap_content"
192   - android:layout_height="wrap_content"
193   - android:layout_centerVertical="true"
194   - android:layout_marginLeft="12dp"
195   - android:layout_toRightOf="@id/iv_device_declare"
196   - android:text="设备说明"
197   - android:textColor="@color/color_282828" />
198   -
199   - <ImageView
200   - android:layout_width="7dp"
201   - android:layout_height="13dp"
202   - android:layout_alignParentRight="true"
203   - android:layout_centerVertical="true"
204   - android:layout_marginRight="10dp"
205   - android:background="@drawable/icon_item_right_arrow" />
206   - </RelativeLayout>
207   - <!-- -->
208   - </LinearLayout>
209   - </LinearLayout>
  15 + android:layout_height="match_parent"></RelativeLayout>
  16 + </RelativeLayout>
210 17 </layout>
211 18 \ No newline at end of file
... ...
module_xiaojiaSoundBox/src/main/res/layout/activity_device_info.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<layout>
  3 +
  4 + <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  5 + xmlns:app="http://schemas.android.com/apk/res-auto"
  6 + xmlns:tools="http://schemas.android.com/tools"
  7 + android:layout_width="match_parent"
  8 + android:layout_height="match_parent"
  9 + android:background="@color/color_F2F2F2"
  10 + android:orientation="vertical"
  11 + tools:context=".ui.activity.DeviceInfoActivity">
  12 +
  13 + <com.qmuiteam.qmui.widget.QMUITopBar
  14 + android:id="@+id/topbar"
  15 + android:layout_width="match_parent"
  16 + android:layout_height="?attr/qmui_topbar_height" />
  17 + <!--ip地址-->
  18 + <LinearLayout
  19 + android:id="@+id/ll_device_name"
  20 + android:layout_width="match_parent"
  21 + android:layout_height="50dp"
  22 + android:layout_marginTop="10dp"
  23 + android:layout_marginBottom="10dp"
  24 + android:background="@drawable/selectable_item_white"
  25 + android:clickable="true">
  26 +
  27 + <LinearLayout
  28 + android:layout_width="wrap_content"
  29 + android:layout_height="match_parent"
  30 + android:gravity="center|left">
  31 +
  32 + <TextView
  33 + android:layout_width="wrap_content"
  34 + android:layout_height="wrap_content"
  35 + android:layout_centerVertical="true"
  36 + android:layout_marginLeft="10dp"
  37 + android:layout_marginRight="10dp"
  38 + android:maxLines="1"
  39 + android:text="IP地址"
  40 + android:textColor="@color/color_282828"
  41 + android:textSize="16sp" />
  42 + </LinearLayout>
  43 +
  44 + <LinearLayout
  45 + android:layout_width="0dp"
  46 + android:layout_height="match_parent"
  47 + android:layout_weight="1"
  48 + android:gravity="center|right">
  49 +
  50 + <TextView
  51 + android:id="@+id/tv_ip_addr"
  52 + android:layout_width="wrap_content"
  53 + android:layout_height="wrap_content"
  54 + android:layout_centerVertical="true"
  55 + android:layout_marginLeft="10dp"
  56 + android:layout_marginRight="10dp"
  57 + android:layout_toEndOf="@id/iv_right"
  58 + android:layout_toRightOf="@id/tv_menu_title"
  59 + android:gravity="center|right"
  60 + android:maxLines="1"
  61 + android:textColor="@color/color_C3C3C3"
  62 + android:textSize="14sp" />
  63 +
  64 + <ImageView
  65 + android:id="@+id/iv_right"
  66 + android:layout_width="7dp"
  67 + android:layout_height="13dp"
  68 + android:layout_marginRight="10dp"
  69 + android:background="@drawable/icon_item_right_arrow"
  70 + android:visibility="gone" />
  71 +
  72 + </LinearLayout>
  73 +
  74 + </LinearLayout>
  75 + <!-- mac地址-->
  76 + <LinearLayout
  77 + android:layout_width="match_parent"
  78 + android:layout_height="50dp"
  79 + android:layout_marginTop="10dp"
  80 + android:layout_marginBottom="10dp"
  81 + android:background="@drawable/selectable_item_white"
  82 + android:clickable="true">
  83 +
  84 + <LinearLayout
  85 + android:layout_width="wrap_content"
  86 + android:layout_height="match_parent"
  87 + android:gravity="center|left">
  88 +
  89 + <TextView
  90 + android:layout_width="wrap_content"
  91 + android:layout_height="wrap_content"
  92 + android:layout_centerVertical="true"
  93 + android:layout_marginLeft="10dp"
  94 + android:layout_marginRight="10dp"
  95 + android:maxLines="1"
  96 + android:text="设备Mac地址"
  97 + android:textColor="@color/color_282828"
  98 + android:textSize="16sp" />
  99 + </LinearLayout>
  100 +
  101 + <LinearLayout
  102 + android:layout_width="0dp"
  103 + android:layout_height="match_parent"
  104 + android:layout_weight="1"
  105 + android:gravity="center|right">
  106 +
  107 + <TextView
  108 + android:id="@+id/tv_mac_addr"
  109 + android:layout_width="wrap_content"
  110 + android:layout_height="wrap_content"
  111 + android:layout_centerVertical="true"
  112 + android:layout_marginLeft="10dp"
  113 + android:layout_marginRight="10dp"
  114 + android:layout_toEndOf="@id/iv_right"
  115 + android:layout_toRightOf="@id/tv_menu_title"
  116 + android:gravity="center|right"
  117 + android:maxLines="1"
  118 + android:textColor="@color/color_C3C3C3"
  119 + android:textSize="14sp" />
  120 +
  121 + <ImageView
  122 + android:layout_width="7dp"
  123 + android:layout_height="13dp"
  124 + android:layout_marginRight="10dp"
  125 + android:background="@drawable/icon_item_right_arrow"
  126 + android:visibility="gone" />
  127 +
  128 + </LinearLayout>
  129 +
  130 + </LinearLayout>
  131 + <!-- sn-->
  132 + <LinearLayout
  133 + android:layout_width="match_parent"
  134 + android:layout_height="50dp"
  135 + android:layout_marginTop="10dp"
  136 + android:layout_marginBottom="10dp"
  137 + android:background="@drawable/selectable_item_white"
  138 + android:clickable="true">
  139 +
  140 + <LinearLayout
  141 + android:layout_width="wrap_content"
  142 + android:layout_height="match_parent"
  143 + android:gravity="center|left">
  144 +
  145 + <TextView
  146 + android:layout_width="wrap_content"
  147 + android:layout_height="wrap_content"
  148 + android:layout_centerVertical="true"
  149 + android:layout_marginLeft="10dp"
  150 + android:layout_marginRight="10dp"
  151 + android:maxLines="1"
  152 + android:text="SN号"
  153 + android:textColor="@color/color_282828"
  154 + android:textSize="16sp" />
  155 + </LinearLayout>
  156 +
  157 + <LinearLayout
  158 + android:layout_width="0dp"
  159 + android:layout_height="match_parent"
  160 + android:layout_weight="1"
  161 + android:gravity="center|right">
  162 +
  163 + <TextView
  164 + android:id="@+id/tv_sn"
  165 + android:layout_width="wrap_content"
  166 + android:layout_height="wrap_content"
  167 + android:layout_centerVertical="true"
  168 + android:layout_marginLeft="10dp"
  169 + android:layout_marginRight="10dp"
  170 + android:layout_toEndOf="@id/iv_right"
  171 + android:layout_toRightOf="@id/tv_menu_title"
  172 + android:gravity="center|right"
  173 + android:maxLines="1"
  174 + android:textColor="@color/color_C3C3C3"
  175 + android:textSize="14sp" />
  176 +
  177 + <ImageView
  178 + android:layout_width="7dp"
  179 + android:layout_height="13dp"
  180 + android:layout_marginRight="10dp"
  181 + android:background="@drawable/icon_item_right_arrow"
  182 + android:visibility="gone" />
  183 +
  184 + </LinearLayout>
  185 +
  186 + </LinearLayout>
  187 + <!-- -->
  188 + </LinearLayout>
  189 +</layout>
0 190 \ No newline at end of file
... ...
module_xiaojiaSoundBox/src/main/res/layout/fragment_device_detail.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<layout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + xmlns:app="http://schemas.android.com/apk/res-auto">
  4 +
  5 + <LinearLayout
  6 + android:layout_width="match_parent"
  7 + android:layout_height="match_parent"
  8 + android:background="@color/color_F2F2F2"
  9 + android:orientation="vertical">
  10 +
  11 + <com.qmuiteam.qmui.widget.QMUITopBar
  12 + android:id="@+id/topbar"
  13 + android:layout_width="match_parent"
  14 + android:layout_height="?attr/qmui_topbar_height" />
  15 + <!--远程控制-->
  16 + <LinearLayout
  17 + android:layout_width="match_parent"
  18 + android:layout_height="90dp"
  19 + android:layout_margin="10dp"
  20 + android:background="@drawable/shape_10_radius_white_bg"
  21 + android:clickable="true"
  22 + android:orientation="vertical">
  23 +
  24 + <LinearLayout
  25 + android:layout_width="match_parent"
  26 + android:layout_height="wrap_content"
  27 + android:layout_marginTop="20dp"
  28 + android:gravity="center_vertical">
  29 +
  30 + <TextView
  31 + android:id="@+id/tv_menu_title"
  32 + android:layout_width="0dp"
  33 + android:layout_height="wrap_content"
  34 + android:layout_marginLeft="10dp"
  35 + android:layout_marginRight="10dp"
  36 + android:layout_weight="1"
  37 + android:maxLines="1"
  38 + android:text="远程控制"
  39 + android:textColor="@color/color_282828"
  40 + android:textSize="16sp" />
  41 +
  42 + <com.cnlive.strike.xiaojiaspeaker.ui.widget.switchbutton.SwitchButton
  43 + android:id="@+id/sb_switch"
  44 + android:layout_width="wrap_content"
  45 + android:layout_height="wrap_content"
  46 + android:layout_gravity="right"
  47 + android:layout_marginRight="10dp"
  48 + app:kswBackDrawable="@drawable/miui_back_drawable"
  49 + app:kswThumbDrawable="@drawable/miui_thumb_drawable"
  50 + app:kswThumbHeight="20dp"
  51 + app:kswThumbRangeRatio="2.1"
  52 + app:kswThumbWidth="20dp" />
  53 + </LinearLayout>
  54 +
  55 + <TextView
  56 + android:id="@+id/tv_menu_detail"
  57 + android:layout_width="wrap_content"
  58 + android:layout_height="wrap_content"
  59 + android:layout_centerVertical="true"
  60 + android:layout_marginLeft="10dp"
  61 + android:layout_marginTop="10dp"
  62 + android:layout_marginRight="10dp"
  63 + android:layout_marginBottom="20dp"
  64 + android:layout_toEndOf="@id/iv_right"
  65 + android:layout_toRightOf="@id/tv_menu_title"
  66 + android:gravity="center|right"
  67 + android:maxLines="1"
  68 + android:text="手机可远程控制音箱播放的内容,但仅限听见中国"
  69 + android:textColor="@color/color_C3C3C3"
  70 + android:textSize="14sp" />
  71 +
  72 + </LinearLayout>
  73 + <!-- -->
  74 + <LinearLayout
  75 + android:layout_width="match_parent"
  76 + android:layout_height="wrap_content"
  77 + android:layout_margin="10dp"
  78 + android:background="@drawable/shape_10_radius_white_bg"
  79 + android:orientation="vertical">
  80 + <!--使用者管理-->
  81 + <LinearLayout
  82 + android:layout_width="match_parent"
  83 + android:layout_height="wrap_content"
  84 + android:orientation="vertical">
  85 +
  86 + <RelativeLayout
  87 + android:id="@+id/rl_user_manager"
  88 + android:layout_width="match_parent"
  89 + android:layout_height="60dp"
  90 + android:clickable="true">
  91 +
  92 + <ImageView
  93 + android:id="@+id/iv_user_manager"
  94 + android:layout_width="29dp"
  95 + android:layout_height="29dp"
  96 + android:layout_centerVertical="true"
  97 + android:layout_marginLeft="10dp"
  98 + android:background="@drawable/icon_user_manager" />
  99 +
  100 + <TextView
  101 + android:layout_width="wrap_content"
  102 + android:layout_height="wrap_content"
  103 + android:layout_centerVertical="true"
  104 + android:layout_marginLeft="10dp"
  105 + android:layout_toRightOf="@id/iv_user_manager"
  106 + android:text="使用者管理"
  107 + android:textColor="@color/color_282828" />
  108 +
  109 + <ImageView
  110 + android:layout_width="7dp"
  111 + android:layout_height="13dp"
  112 + android:layout_alignParentRight="true"
  113 + android:layout_centerVertical="true"
  114 + android:layout_marginRight="10dp"
  115 + android:background="@drawable/icon_item_right_arrow" />
  116 + </RelativeLayout>
  117 +
  118 + <View
  119 + android:layout_width="match_parent"
  120 + android:layout_height="1dp"
  121 + android:layout_marginLeft="10dp"
  122 + android:layout_marginRight="10dp"
  123 + android:background="@color/line" />
  124 + </LinearLayout>
  125 +
  126 +
  127 + <!--设备管理-->
  128 + <RelativeLayout
  129 + android:id="@+id/rl_device_manager"
  130 + android:layout_width="match_parent"
  131 + android:layout_height="60dp"
  132 + android:clickable="true">
  133 +
  134 + <ImageView
  135 + android:id="@+id/iv_device_manager"
  136 + android:layout_width="21dp"
  137 + android:layout_height="21dp"
  138 + android:layout_centerVertical="true"
  139 + android:layout_marginLeft="13dp"
  140 + android:background="@drawable/icon_device_manager" />
  141 +
  142 + <TextView
  143 + android:layout_width="wrap_content"
  144 + android:layout_height="wrap_content"
  145 + android:layout_centerVertical="true"
  146 + android:layout_marginLeft="15dp"
  147 + android:layout_toRightOf="@id/iv_device_manager"
  148 + android:text="设备管理"
  149 + android:textColor="@color/color_282828" />
  150 +
  151 + <View
  152 + android:layout_width="9dp"
  153 + android:layout_height="9dp"
  154 + android:layout_centerVertical="true"
  155 + android:layout_marginRight="10dp"
  156 + android:layout_toLeftOf="@id/iv_device_manager_continue"
  157 + android:background="@drawable/shape_red_circle"
  158 + android:visibility="gone" />
  159 +
  160 + <ImageView
  161 + android:id="@+id/iv_device_manager_continue"
  162 + android:layout_width="wrap_content"
  163 + android:layout_height="wrap_content"
  164 + android:layout_alignParentRight="true"
  165 + android:layout_centerVertical="true"
  166 + android:layout_marginRight="10dp"
  167 + android:background="@drawable/icon_item_right_arrow" />
  168 + </RelativeLayout>
  169 +
  170 + <View
  171 + android:layout_width="match_parent"
  172 + android:layout_height="1dp"
  173 + android:layout_marginLeft="10dp"
  174 + android:layout_marginRight="10dp"
  175 + android:background="@color/line" />
  176 + <!--设备说明-->
  177 + <RelativeLayout
  178 + android:id="@+id/rl_device_declare"
  179 + android:layout_width="match_parent"
  180 + android:layout_height="60dp"
  181 + android:clickable="true">
  182 +
  183 + <ImageView
  184 + android:id="@+id/iv_device_declare"
  185 + android:layout_width="23dp"
  186 + android:layout_height="23dp"
  187 + android:layout_centerVertical="true"
  188 + android:layout_marginLeft="13dp"
  189 + android:background="@drawable/icon_device_declare" />
  190 +
  191 + <TextView
  192 + android:layout_width="wrap_content"
  193 + android:layout_height="wrap_content"
  194 + android:layout_centerVertical="true"
  195 + android:layout_marginLeft="12dp"
  196 + android:layout_toRightOf="@id/iv_device_declare"
  197 + android:text="设备说明"
  198 + android:textColor="@color/color_282828" />
  199 +
  200 + <ImageView
  201 + android:layout_width="7dp"
  202 + android:layout_height="13dp"
  203 + android:layout_alignParentRight="true"
  204 + android:layout_centerVertical="true"
  205 + android:layout_marginRight="10dp"
  206 + android:background="@drawable/icon_item_right_arrow" />
  207 + </RelativeLayout>
  208 + <!-- -->
  209 + </LinearLayout>
  210 + </LinearLayout>
  211 +</layout>
0 212 \ No newline at end of file
... ...
module_xiaojiaSoundBox/src/main/res/layout/fragment_device_manager.xml
... ... @@ -299,6 +299,7 @@
299 299 </ScrollView>
300 300  
301 301 <TextView
  302 + android:id="@+id/tv_delete_device"
302 303 android:layout_width="match_parent"
303 304 android:layout_height="60dp"
304 305 android:layout_alignParentBottom="true"
... ...
module_xiaojiaSoundBox/src/main/res/layout/fragment_firmware_update.xml
... ... @@ -98,7 +98,8 @@
98 98 android:layout_gravity="center"
99 99 android:layout_marginLeft="50dp"
100 100 android:layout_marginBottom="10dp"
101   - android:background="@drawable/shape_red_circle" />
  101 + android:background="@drawable/shape_red_circle"
  102 + android:visibility="gone" />
102 103 </FrameLayout>
103 104  
104 105 </LinearLayout>
... ...