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,16 +26,16 @@ public class MainActivity extends AppCompatActivity { | ||
| 26 | protected void onCreate(Bundle savedInstanceState) { | 26 | protected void onCreate(Bundle savedInstanceState) { |
| 27 | super.onCreate(savedInstanceState); | 27 | super.onCreate(savedInstanceState); |
| 28 | setContentView(R.layout.activity_speaker_main); | 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 | // XiaoJIaCommInfo.setUserId(this, "10513196"); | 31 | // XiaoJIaCommInfo.setUserId(this, "10513196"); |
| 32 | // XiaoJIaCommInfo.setUserPhone(this, "15010140838"); | 32 | // XiaoJIaCommInfo.setUserPhone(this, "15010140838"); |
| 33 | 33 | ||
| 34 | // startActivity(new Intent(MainActivity.this, ToolBarTestActivity.class)); | 34 | // startActivity(new Intent(MainActivity.this, ToolBarTestActivity.class)); |
| 35 | // startActivity(new Intent(MainActivity.this, BluetoothConnActivity.class)); | 35 | // startActivity(new Intent(MainActivity.this, BluetoothConnActivity.class)); |
| 36 | // startActivity(new Intent(MainActivity.this, BlueToothStep1Activity.class)); | 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 | // startActivity(new Intent(MainActivity.this, DeviceInstructionActivity.class)); | 39 | // startActivity(new Intent(MainActivity.this, DeviceInstructionActivity.class)); |
| 40 | // startActivity(new Intent(MainActivity.this, DeviceManagerActivity.class)); | 40 | // startActivity(new Intent(MainActivity.this, DeviceManagerActivity.class)); |
| 41 | // startActivity(new Intent(MainActivity.this, FirmwareUpdateActivity.class)); | 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,6 +2,7 @@ package com.cnlive.strike.xiaojiaspeaker.frame.presenter; | ||
| 2 | 2 | ||
| 3 | import android.app.Activity; | 3 | import android.app.Activity; |
| 4 | import android.content.Context; | 4 | import android.content.Context; |
| 5 | +import android.os.Handler; | ||
| 5 | import android.util.Log; | 6 | import android.util.Log; |
| 6 | 7 | ||
| 7 | import com.cnlive.libs.base.logic.Logic; | 8 | import com.cnlive.libs.base.logic.Logic; |
| @@ -28,7 +29,7 @@ public class ChangeDeviceNamePresenter extends MvpBasePresenter<ChangeDeviceName | @@ -28,7 +29,7 @@ public class ChangeDeviceNamePresenter extends MvpBasePresenter<ChangeDeviceName | ||
| 28 | 29 | ||
| 29 | private String TAG = "ChangeDeviceNamePresenter"; | 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 | if (null == getView()) { | 33 | if (null == getView()) { |
| 33 | return; | 34 | return; |
| 34 | } | 35 | } |
| @@ -51,9 +52,20 @@ public class ChangeDeviceNamePresenter extends MvpBasePresenter<ChangeDeviceName | @@ -51,9 +52,20 @@ public class ChangeDeviceNamePresenter extends MvpBasePresenter<ChangeDeviceName | ||
| 51 | if (null == getView()) { | 52 | if (null == getView()) { |
| 52 | return; | 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 | QMUITipDialogUtil.dismessDialog(); | 56 | QMUITipDialogUtil.dismessDialog(); |
| 56 | QMUITipDialogUtil.successDialog(context, "保存成功", 1); | 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 | .setFailureCallback(new FailureCallback() { | 71 | .setFailureCallback(new FailureCallback() { |
| @@ -71,4 +83,8 @@ public class ChangeDeviceNamePresenter extends MvpBasePresenter<ChangeDeviceName | @@ -71,4 +83,8 @@ public class ChangeDeviceNamePresenter extends MvpBasePresenter<ChangeDeviceName | ||
| 71 | 83 | ||
| 72 | .start(); | 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,6 +8,7 @@ import com.cnlive.libs.base.logic.callback.DataCallback; | ||
| 8 | import com.cnlive.libs.base.logic.callback.FailureCallback; | 8 | import com.cnlive.libs.base.logic.callback.FailureCallback; |
| 9 | import com.cnlive.libs.base.logic.callback.SuccessCallback; | 9 | import com.cnlive.libs.base.logic.callback.SuccessCallback; |
| 10 | import com.cnlive.strike.xiaojiaspeaker.frame.view.SelectWifiFragmentView; | 10 | import com.cnlive.strike.xiaojiaspeaker.frame.view.SelectWifiFragmentView; |
| 11 | +import com.cnlive.strike.xiaojiaspeaker.model.message.EventMsg; | ||
| 11 | import com.cnlive.strike.xiaojiaspeaker.netWork.ApiServiceXiaoJia; | 12 | import com.cnlive.strike.xiaojiaspeaker.netWork.ApiServiceXiaoJia; |
| 12 | import com.cnlive.strike.xiaojiaspeaker.netWork.bean.NetworkResultBean; | 13 | import com.cnlive.strike.xiaojiaspeaker.netWork.bean.NetworkResultBean; |
| 13 | import com.cnlive.strike.xiaojiaspeaker.netWork.bean.APIBaseInfo; | 14 | import com.cnlive.strike.xiaojiaspeaker.netWork.bean.APIBaseInfo; |
| @@ -15,6 +16,8 @@ import com.cnlive.strike.xiaojiaspeaker.netWork.result.SubscriptionRequest; | @@ -15,6 +16,8 @@ import com.cnlive.strike.xiaojiaspeaker.netWork.result.SubscriptionRequest; | ||
| 15 | import com.cnlive.strike.xiaojiaspeaker.util.QMUITipDialogUtil; | 16 | import com.cnlive.strike.xiaojiaspeaker.util.QMUITipDialogUtil; |
| 16 | import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; | 17 | import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; |
| 17 | 18 | ||
| 19 | +import org.greenrobot.eventbus.EventBus; | ||
| 20 | + | ||
| 18 | import java.util.HashMap; | 21 | import java.util.HashMap; |
| 19 | import java.util.Map; | 22 | import java.util.Map; |
| 20 | 23 | ||
| @@ -24,7 +27,7 @@ public class SelectWifiFragmentPresenter extends MvpBasePresenter<SelectWifiFrag | @@ -24,7 +27,7 @@ public class SelectWifiFragmentPresenter extends MvpBasePresenter<SelectWifiFrag | ||
| 24 | private String TAG = "SelectWifiFragmentPresenter"; | 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 | if (null == getView()) { | 31 | if (null == getView()) { |
| 29 | return; | 32 | return; |
| 30 | } | 33 | } |
| @@ -44,15 +47,19 @@ public class SelectWifiFragmentPresenter extends MvpBasePresenter<SelectWifiFrag | @@ -44,15 +47,19 @@ public class SelectWifiFragmentPresenter extends MvpBasePresenter<SelectWifiFrag | ||
| 44 | if (null == getView()) { | 47 | if (null == getView()) { |
| 45 | return; | 48 | return; |
| 46 | } | 49 | } |
| 50 | + EventBus.getDefault().post(new EventMsg(EventMsg.CLOSE_BLUETOOTH_ACTIVITY,null)); | ||
| 47 | QMUITipDialogUtil.dismessDialog(); | 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 | .setFailureCallback(new FailureCallback() { | 58 | .setFailureCallback(new FailureCallback() { |
| 52 | @Override | 59 | @Override |
| 53 | public void onFailure(int i, String s) { | 60 | public void onFailure(int i, String s) { |
| 54 | //显示重试 | 61 | //显示重试 |
| 55 | - Log.e(TAG, "onFailure: "+s); | 62 | + Log.e(TAG, "onFailure: " + s); |
| 56 | QMUITipDialogUtil.dismessDialog(); | 63 | QMUITipDialogUtil.dismessDialog(); |
| 57 | } | 64 | } |
| 58 | }) | 65 | }) |
| @@ -99,4 +106,8 @@ public class SelectWifiFragmentPresenter extends MvpBasePresenter<SelectWifiFrag | @@ -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,7 +24,7 @@ public class AllDeviceFragmentView implements MvpView { | ||
| 24 | private AllDeviceFragment fragment; | 24 | private AllDeviceFragment fragment; |
| 25 | private AllDeviceAdapter adapter; | 25 | private AllDeviceAdapter adapter; |
| 26 | private List<FamilyListBean.UsersBeanX.DeviceListBean> allDeviceInfoList; | 26 | private List<FamilyListBean.UsersBeanX.DeviceListBean> allDeviceInfoList; |
| 27 | -// private List<PopMenuInfo> popMenuInfoList = null; | 27 | + // private List<PopMenuInfo> popMenuInfoList = null; |
| 28 | // private PopMenu mPopMenu; | 28 | // private PopMenu mPopMenu; |
| 29 | private String TAG = "AllDeviceFragmentView"; | 29 | private String TAG = "AllDeviceFragmentView"; |
| 30 | private FamilyListBean familyListBean; | 30 | private FamilyListBean familyListBean; |
| @@ -50,7 +50,7 @@ public class AllDeviceFragmentView implements MvpView { | @@ -50,7 +50,7 @@ public class AllDeviceFragmentView implements MvpView { | ||
| 50 | for (FamilyListBean.UsersBeanX usersBean : familyListBean.getUsers()) { | 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 | Log.e(TAG, "getId: " + usersBean.getUserId()); | 54 | Log.e(TAG, "getId: " + usersBean.getUserId()); |
| 55 | Log.e(TAG, "getToken: " + usersBean.getToken()); | 55 | Log.e(TAG, "getToken: " + usersBean.getToken()); |
| 56 | //存储家庭id | 56 | //存储家庭id |
| @@ -83,7 +83,7 @@ public class AllDeviceFragmentView implements MvpView { | @@ -83,7 +83,7 @@ public class AllDeviceFragmentView implements MvpView { | ||
| 83 | adapter.setOnItemClickListener(new AllDeviceAdapter.OnItemClickListener() { | 83 | adapter.setOnItemClickListener(new AllDeviceAdapter.OnItemClickListener() { |
| 84 | @Override | 84 | @Override |
| 85 | public void onItemClick(int position, FamilyListBean.UsersBeanX.DeviceListBean AllDeviceInfo) { | 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,6 +8,7 @@ import android.text.TextWatcher; | ||
| 8 | import android.view.View; | 8 | import android.view.View; |
| 9 | 9 | ||
| 10 | import com.cnlive.strike.xiaojiaspeaker.R; | 10 | import com.cnlive.strike.xiaojiaspeaker.R; |
| 11 | +import com.cnlive.strike.xiaojiaspeaker.frame.presenter.ChangeDeviceNamePresenter; | ||
| 11 | import com.cnlive.strike.xiaojiaspeaker.netWork.bean.DeviceDetail; | 12 | import com.cnlive.strike.xiaojiaspeaker.netWork.bean.DeviceDetail; |
| 12 | import com.cnlive.strike.xiaojiaspeaker.ui.activity.ChangeDeviceNameActivity; | 13 | import com.cnlive.strike.xiaojiaspeaker.ui.activity.ChangeDeviceNameActivity; |
| 13 | import com.cnlive.strike.xiaojiaspeaker.ui.fragment.ChangeDeviceNameFragment; | 14 | import com.cnlive.strike.xiaojiaspeaker.ui.fragment.ChangeDeviceNameFragment; |
| @@ -61,7 +62,14 @@ public class ChangeDeviceNameView implements MvpView { | @@ -61,7 +62,14 @@ public class ChangeDeviceNameView implements MvpView { | ||
| 61 | fragment.binding.btnNext.setOnClickListener(new View.OnClickListener() { | 62 | fragment.binding.btnNext.setOnClickListener(new View.OnClickListener() { |
| 62 | @Override | 63 | @Override |
| 63 | public void onClick(View view) { | 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,7 +39,8 @@ public class InvitFriendView implements MvpView { | ||
| 39 | private InvitFriendFragment fragment; | 39 | private InvitFriendFragment fragment; |
| 40 | private List<RoleInfo> roleInfoList; | 40 | private List<RoleInfo> roleInfoList; |
| 41 | private SetRoleAdapter setRoleAdapter; | 41 | private SetRoleAdapter setRoleAdapter; |
| 42 | - private String encryptionContent; | 42 | + private String encryptionContent; |
| 43 | + private String currentSelectFamilyId; | ||
| 43 | 44 | ||
| 44 | public InvitFriendView(InvitFriendFragment fragment) { | 45 | public InvitFriendView(InvitFriendFragment fragment) { |
| 45 | this.fragment = fragment; | 46 | this.fragment = fragment; |
| @@ -49,11 +50,12 @@ public class InvitFriendView implements MvpView { | @@ -49,11 +50,12 @@ public class InvitFriendView implements MvpView { | ||
| 49 | return fragment == null ? null : fragment.getActivity(); | 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 | fragment.binding.btnShare.setOnClickListener(v -> { | 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,7 +75,7 @@ public class SearchDevicefragmentView implements MvpView { | ||
| 75 | fragment.binding.tvPreviousStep.setOnClickListener(new View.OnClickListener() { | 75 | fragment.binding.tvPreviousStep.setOnClickListener(new View.OnClickListener() { |
| 76 | @Override | 76 | @Override |
| 77 | public void onClick(View view) { | 77 | public void onClick(View view) { |
| 78 | - BlueToothStep2Activity.startActivity(getContext()); | 78 | +// BlueToothStep2Activity.startActivity(getContext()); |
| 79 | fragment.getActivity().finish(); | 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,6 +21,9 @@ import com.cnlive.libs.base.util.AlertUtil; | ||
| 21 | import com.cnlive.strike.xiaojiaspeaker.R; | 21 | import com.cnlive.strike.xiaojiaspeaker.R; |
| 22 | import com.cnlive.strike.xiaojiaspeaker.commonInfo.XiaoJIaCommInfo; | 22 | import com.cnlive.strike.xiaojiaspeaker.commonInfo.XiaoJIaCommInfo; |
| 23 | import com.cnlive.strike.xiaojiaspeaker.constants.BlufiConstants; | 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 | import com.cnlive.strike.xiaojiaspeaker.ui.adapter.WifiRecycleAdapter; | 27 | import com.cnlive.strike.xiaojiaspeaker.ui.adapter.WifiRecycleAdapter; |
| 25 | import com.cnlive.strike.xiaojiaspeaker.ui.fragment.SelectWifiFragment; | 28 | import com.cnlive.strike.xiaojiaspeaker.ui.fragment.SelectWifiFragment; |
| 26 | import com.cnlive.strike.xiaojiaspeaker.ui.widget.TipDialog; | 29 | import com.cnlive.strike.xiaojiaspeaker.ui.widget.TipDialog; |
| @@ -48,10 +51,25 @@ public class SelectWifiFragmentView implements MvpView { | @@ -48,10 +51,25 @@ public class SelectWifiFragmentView implements MvpView { | ||
| 48 | private String familyId; | 51 | private String familyId; |
| 49 | private String cmccId;//移动id | 52 | private String cmccId;//移动id |
| 50 | private final int DELAY_TIME = 10;//延时查询10秒 | 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 | public SelectWifiFragmentView(SelectWifiFragment fragment) { | 58 | public SelectWifiFragmentView(SelectWifiFragment fragment) { |
| 53 | this.fragment = fragment; | 59 | this.fragment = fragment; |
| 54 | wifiUtils = new WifiUtils(fragment.getActivity()); | 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 | public Activity getContext() { | 75 | public Activity getContext() { |
| @@ -201,6 +219,11 @@ public class SelectWifiFragmentView implements MvpView { | @@ -201,6 +219,11 @@ public class SelectWifiFragmentView implements MvpView { | ||
| 201 | // 连接成功,BleDevice即为所连接的BLE设备 | 219 | // 连接成功,BleDevice即为所连接的BLE设备 |
| 202 | @Override | 220 | @Override |
| 203 | public void onConnectSuccess(final BleDevice bleDevice, BluetoothGatt gatt, int status) { | 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 | BleManager.getInstance().notify( | 227 | BleManager.getInstance().notify( |
| 205 | bleDevice, | 228 | bleDevice, |
| 206 | BlufiConstants.UUID_WIFI_SERVICE.toString(), | 229 | BlufiConstants.UUID_WIFI_SERVICE.toString(), |
| @@ -247,6 +270,7 @@ public class SelectWifiFragmentView implements MvpView { | @@ -247,6 +270,7 @@ public class SelectWifiFragmentView implements MvpView { | ||
| 247 | String result = new String(data, "UTF-8"); | 270 | String result = new String(data, "UTF-8"); |
| 248 | Log.e(TAG, "onCharacteristicChanged: " + result); | 271 | Log.e(TAG, "onCharacteristicChanged: " + result); |
| 249 | if (result.indexOf(BlufiConstants.WIFI_LINK_OK) != -1) { | 272 | if (result.indexOf(BlufiConstants.WIFI_LINK_OK) != -1) { |
| 273 | + isSetNetSuccess = true; | ||
| 250 | BleManager.getInstance().stopNotify(bleDevice, BlufiConstants.UUID_WIFI_SERVICE.toString(), BlufiConstants.UUID_NOTIFY_CHARACTERISTIC.toString()); | 274 | BleManager.getInstance().stopNotify(bleDevice, BlufiConstants.UUID_WIFI_SERVICE.toString(), BlufiConstants.UUID_NOTIFY_CHARACTERISTIC.toString()); |
| 251 | BleManager.getInstance().disconnect(bleDevice); | 275 | BleManager.getInstance().disconnect(bleDevice); |
| 252 | //查询配网是否成功 | 276 | //查询配网是否成功 |
| @@ -257,10 +281,18 @@ public class SelectWifiFragmentView implements MvpView { | @@ -257,10 +281,18 @@ public class SelectWifiFragmentView implements MvpView { | ||
| 257 | new Handler().postDelayed(new Runnable() { | 281 | new Handler().postDelayed(new Runnable() { |
| 258 | @Override | 282 | @Override |
| 259 | public void run() { | 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 | } else if (result.indexOf(BlufiConstants.WIFI_LINK_FAIL) != -1) { | 292 | } else if (result.indexOf(BlufiConstants.WIFI_LINK_FAIL) != -1) { |
| 293 | + if (null != failHandler && null != failRunnable) { | ||
| 294 | + failHandler.removeCallbacks(failRunnable); | ||
| 295 | + } | ||
| 264 | if (null != errorDialog) { | 296 | if (null != errorDialog) { |
| 265 | if (!TextUtils.isEmpty(SSID)) { | 297 | if (!TextUtils.isEmpty(SSID)) { |
| 266 | errorDialog.setTipMsg(SSID + "\n密码错误"); | 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,7 +179,14 @@ public class UserManagerView implements MvpView { | ||
| 179 | fragment.binding.btnQrcode.setOnClickListener(new View.OnClickListener() { | 179 | fragment.binding.btnQrcode.setOnClickListener(new View.OnClickListener() { |
| 180 | @Override | 180 | @Override |
| 181 | public void onClick(View view) { | 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,7 +356,7 @@ public class UserManagerView implements MvpView { | ||
| 349 | @Override | 356 | @Override |
| 350 | public void onClick(int position, PopMenuInfo popMenuInfo) { | 357 | public void onClick(int position, PopMenuInfo popMenuInfo) { |
| 351 | if (position == 1) { | 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,6 +3,7 @@ package com.cnlive.strike.xiaojiaspeaker.model.message; | ||
| 3 | public class EventMsg { | 3 | public class EventMsg { |
| 4 | public static final int CHANGE_DEVICE_NAME_SUCCESS = 0;//修改时设备名称成功 | 4 | public static final int CHANGE_DEVICE_NAME_SUCCESS = 0;//修改时设备名称成功 |
| 5 | public static final int DELETE_DEVICE_NAME_SUCCESS = 1;//删除设备成功 | 5 | public static final int DELETE_DEVICE_NAME_SUCCESS = 1;//删除设备成功 |
| 6 | + public static final int CLOSE_BLUETOOTH_ACTIVITY = 0;//关闭配网页面 | ||
| 6 | 7 | ||
| 7 | private int eventType; | 8 | private int eventType; |
| 8 | private Object data; | 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,8 +7,8 @@ import java.util.List; | ||
| 7 | * 家庭id | 7 | * 家庭id |
| 8 | */ | 8 | */ |
| 9 | public class FamilyListBean implements Serializable { | 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,7 +53,7 @@ public class FamilyListBean implements Serializable { | ||
| 53 | private String userId; | 53 | private String userId; |
| 54 | private String name; | 54 | private String name; |
| 55 | private String img; | 55 | private String img; |
| 56 | - private int isMaster; | 56 | + private String isMaster; |
| 57 | private List<DeviceListBean> deviceList; | 57 | private List<DeviceListBean> deviceList; |
| 58 | 58 | ||
| 59 | public String getId() { | 59 | public String getId() { |
| @@ -104,11 +104,11 @@ public class FamilyListBean implements Serializable { | @@ -104,11 +104,11 @@ public class FamilyListBean implements Serializable { | ||
| 104 | this.img = img; | 104 | this.img = img; |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | - public int getIsMaster() { | 107 | + public String getIsMaster() { |
| 108 | return isMaster; | 108 | return isMaster; |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | - public void setIsMaster(int isMaster) { | 111 | + public void setIsMaster(String isMaster) { |
| 112 | this.isMaster = isMaster; | 112 | this.isMaster = isMaster; |
| 113 | } | 113 | } |
| 114 | 114 | ||
| @@ -985,4 +985,5 @@ public class FamilyListBean implements Serializable { | @@ -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
| 1 | package com.cnlive.strike.xiaojiaspeaker.netWork.bean; | 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 NetworkResultBean { | 8 | +public class NetworkResultBean implements Serializable { |
| 7 | 9 | ||
| 8 | /** | 10 | /** |
| 9 | * mainctl : 4000119C000011AE | 11 | * mainctl : 4000119C000011AE |
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,7 +11,14 @@ import android.view.View; | ||
| 11 | import com.cnlive.libs.base.util.StatusBarUtil; | 11 | import com.cnlive.libs.base.util.StatusBarUtil; |
| 12 | import com.cnlive.libs.base.util.StatusBarUtil2; | 12 | import com.cnlive.libs.base.util.StatusBarUtil2; |
| 13 | import com.cnlive.strike.xiaojiaspeaker.R; | 13 | import com.cnlive.strike.xiaojiaspeaker.R; |
| 14 | +import com.cnlive.strike.xiaojiaspeaker.commonInfo.XiaoJIaCommInfo; | ||
| 14 | import com.cnlive.strike.xiaojiaspeaker.databinding.ActivityBlueToothStep1Binding; | 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 | public class BlueToothStep1Activity extends AppCompatActivity { | 23 | public class BlueToothStep1Activity extends AppCompatActivity { |
| 17 | private ActivityBlueToothStep1Binding binding; | 24 | private ActivityBlueToothStep1Binding binding; |
| @@ -20,17 +27,23 @@ public class BlueToothStep1Activity extends AppCompatActivity { | @@ -20,17 +27,23 @@ public class BlueToothStep1Activity extends AppCompatActivity { | ||
| 20 | protected void onCreate(Bundle savedInstanceState) { | 27 | protected void onCreate(Bundle savedInstanceState) { |
| 21 | super.onCreate(savedInstanceState); | 28 | super.onCreate(savedInstanceState); |
| 22 | binding = DataBindingUtil.setContentView(this, R.layout.activity_blue_tooth_step1); | 29 | binding = DataBindingUtil.setContentView(this, R.layout.activity_blue_tooth_step1); |
| 30 | + EventBusUtil.register(this); | ||
| 23 | initTopBar(); | 31 | initTopBar(); |
| 24 | initView(); | 32 | initView(); |
| 25 | } | 33 | } |
| 26 | 34 | ||
| 35 | + @Override | ||
| 36 | + protected void onDestroy() { | ||
| 37 | + super.onDestroy(); | ||
| 38 | + EventBusUtil.unRegister(this); | ||
| 39 | + } | ||
| 40 | + | ||
| 27 | private void initView() { | 41 | private void initView() { |
| 28 | //下一步 | 42 | //下一步 |
| 29 | binding.btnNext.setOnClickListener(new View.OnClickListener() { | 43 | binding.btnNext.setOnClickListener(new View.OnClickListener() { |
| 30 | @Override | 44 | @Override |
| 31 | public void onClick(View view) { | 45 | public void onClick(View view) { |
| 32 | BlueToothStep2Activity.startActivity(BlueToothStep1Activity.this); | 46 | BlueToothStep2Activity.startActivity(BlueToothStep1Activity.this); |
| 33 | - finish(); | ||
| 34 | } | 47 | } |
| 35 | }); | 48 | }); |
| 36 | } | 49 | } |
| @@ -52,4 +65,11 @@ public class BlueToothStep1Activity extends AppCompatActivity { | @@ -52,4 +65,11 @@ public class BlueToothStep1Activity extends AppCompatActivity { | ||
| 52 | public static void startActivity(Activity activity) { | 65 | public static void startActivity(Activity activity) { |
| 53 | activity.startActivity(new Intent(activity, BlueToothStep1Activity.class)); | 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,11 +26,16 @@ import com.cnlive.libs.base.util.StatusBarUtil; | ||
| 26 | import com.cnlive.libs.base.util.StatusBarUtil2; | 26 | import com.cnlive.libs.base.util.StatusBarUtil2; |
| 27 | import com.cnlive.strike.xiaojiaspeaker.R; | 27 | import com.cnlive.strike.xiaojiaspeaker.R; |
| 28 | import com.cnlive.strike.xiaojiaspeaker.databinding.ActivityBlueToothStep2Binding; | 28 | import com.cnlive.strike.xiaojiaspeaker.databinding.ActivityBlueToothStep2Binding; |
| 29 | +import com.cnlive.strike.xiaojiaspeaker.model.message.EventMsg; | ||
| 29 | import com.cnlive.strike.xiaojiaspeaker.ui.widget.SelectDialog; | 30 | import com.cnlive.strike.xiaojiaspeaker.ui.widget.SelectDialog; |
| 31 | +import com.cnlive.strike.xiaojiaspeaker.util.EventBusUtil; | ||
| 30 | import com.cnlive.strike.xiaojiaspeaker.util.lib_permisshelper.PermissionsListener; | 32 | import com.cnlive.strike.xiaojiaspeaker.util.lib_permisshelper.PermissionsListener; |
| 31 | import com.cnlive.strike.xiaojiaspeaker.util.lib_permisshelper.PermissionsUtils; | 33 | import com.cnlive.strike.xiaojiaspeaker.util.lib_permisshelper.PermissionsUtils; |
| 32 | import com.cnlive.strike.xiaojiaspeaker.util.utilcode.CheckUtil; | 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 | public class BlueToothStep2Activity extends AppCompatActivity { | 39 | public class BlueToothStep2Activity extends AppCompatActivity { |
| 35 | private ActivityBlueToothStep2Binding binding; | 40 | private ActivityBlueToothStep2Binding binding; |
| 36 | private PermissionsUtils mPermissionsUtils = new PermissionsUtils();//权限申请 | 41 | private PermissionsUtils mPermissionsUtils = new PermissionsUtils();//权限申请 |
| @@ -43,6 +48,8 @@ public class BlueToothStep2Activity extends AppCompatActivity { | @@ -43,6 +48,8 @@ public class BlueToothStep2Activity extends AppCompatActivity { | ||
| 43 | protected void onCreate(Bundle savedInstanceState) { | 48 | protected void onCreate(Bundle savedInstanceState) { |
| 44 | super.onCreate(savedInstanceState); | 49 | super.onCreate(savedInstanceState); |
| 45 | binding = DataBindingUtil.setContentView(this, R.layout.activity_blue_tooth_step2); | 50 | binding = DataBindingUtil.setContentView(this, R.layout.activity_blue_tooth_step2); |
| 51 | + EventBusUtil.register(this); | ||
| 52 | + | ||
| 46 | initTopBar(); | 53 | initTopBar(); |
| 47 | initView(); | 54 | initView(); |
| 48 | initPermissionDefineTip(); | 55 | initPermissionDefineTip(); |
| @@ -55,6 +62,7 @@ public class BlueToothStep2Activity extends AppCompatActivity { | @@ -55,6 +62,7 @@ public class BlueToothStep2Activity extends AppCompatActivity { | ||
| 55 | if (null != mStatusReceive) { | 62 | if (null != mStatusReceive) { |
| 56 | unregisterReceiver(mStatusReceive); | 63 | unregisterReceiver(mStatusReceive); |
| 57 | } | 64 | } |
| 65 | + EventBusUtil.unRegister(this); | ||
| 58 | } | 66 | } |
| 59 | 67 | ||
| 60 | private void initBlueToothReceiver() { | 68 | private void initBlueToothReceiver() { |
| @@ -69,7 +77,7 @@ public class BlueToothStep2Activity extends AppCompatActivity { | @@ -69,7 +77,7 @@ public class BlueToothStep2Activity extends AppCompatActivity { | ||
| 69 | binding.tvPreviousStep.setOnClickListener(new View.OnClickListener() { | 77 | binding.tvPreviousStep.setOnClickListener(new View.OnClickListener() { |
| 70 | @Override | 78 | @Override |
| 71 | public void onClick(View view) { | 79 | public void onClick(View view) { |
| 72 | - BlueToothStep1Activity.startActivity(BlueToothStep2Activity.this); | 80 | +// BlueToothStep1Activity.startActivity(BlueToothStep2Activity.this); |
| 73 | finish(); | 81 | finish(); |
| 74 | } | 82 | } |
| 75 | }); | 83 | }); |
| @@ -127,7 +135,6 @@ public class BlueToothStep2Activity extends AppCompatActivity { | @@ -127,7 +135,6 @@ public class BlueToothStep2Activity extends AppCompatActivity { | ||
| 127 | //判断蓝牙是否打开 | 135 | //判断蓝牙是否打开 |
| 128 | if (BleManager.getInstance().isBlueEnable()) { | 136 | if (BleManager.getInstance().isBlueEnable()) { |
| 129 | SearchDeviceActivity.startActivity(BlueToothStep2Activity.this); | 137 | SearchDeviceActivity.startActivity(BlueToothStep2Activity.this); |
| 130 | - finish(); | ||
| 131 | } else { | 138 | } else { |
| 132 | BleManager.getInstance().enableBluetooth(); | 139 | BleManager.getInstance().enableBluetooth(); |
| 133 | } | 140 | } |
| @@ -244,4 +251,10 @@ public class BlueToothStep2Activity extends AppCompatActivity { | @@ -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 +6,7 @@ import android.databinding.DataBindingUtil; | ||
| 6 | import android.support.v4.content.ContextCompat; | 6 | import android.support.v4.content.ContextCompat; |
| 7 | import android.support.v7.app.AppCompatActivity; | 7 | import android.support.v7.app.AppCompatActivity; |
| 8 | import android.os.Bundle; | 8 | import android.os.Bundle; |
| 9 | +import android.text.TextUtils; | ||
| 9 | import android.view.View; | 10 | import android.view.View; |
| 10 | 11 | ||
| 11 | import com.cnlive.libs.base.util.StatusBarUtil; | 12 | import com.cnlive.libs.base.util.StatusBarUtil; |
| @@ -13,6 +14,7 @@ import com.cnlive.libs.base.util.StatusBarUtil2; | @@ -13,6 +14,7 @@ import com.cnlive.libs.base.util.StatusBarUtil2; | ||
| 13 | import com.cnlive.strike.xiaojiaspeaker.R; | 14 | import com.cnlive.strike.xiaojiaspeaker.R; |
| 14 | import com.cnlive.strike.xiaojiaspeaker.commonInfo.XiaoJIaCommInfo; | 15 | import com.cnlive.strike.xiaojiaspeaker.commonInfo.XiaoJIaCommInfo; |
| 15 | import com.cnlive.strike.xiaojiaspeaker.databinding.ActivityConnBluetoothSuccessBinding; | 16 | import com.cnlive.strike.xiaojiaspeaker.databinding.ActivityConnBluetoothSuccessBinding; |
| 17 | +import com.cnlive.strike.xiaojiaspeaker.netWork.bean.NetworkResultBean; | ||
| 16 | import com.daimajia.androidanimations.library.Techniques; | 18 | import com.daimajia.androidanimations.library.Techniques; |
| 17 | import com.daimajia.androidanimations.library.YoYo; | 19 | import com.daimajia.androidanimations.library.YoYo; |
| 18 | 20 | ||
| @@ -23,11 +25,15 @@ import com.daimajia.androidanimations.library.YoYo; | @@ -23,11 +25,15 @@ import com.daimajia.androidanimations.library.YoYo; | ||
| 23 | */ | 25 | */ |
| 24 | public class ConnBluetoothSuccessActivity extends AppCompatActivity { | 26 | public class ConnBluetoothSuccessActivity extends AppCompatActivity { |
| 25 | private ActivityConnBluetoothSuccessBinding binding; | 27 | private ActivityConnBluetoothSuccessBinding binding; |
| 28 | + private NetworkResultBean networkResultBean; | ||
| 26 | 29 | ||
| 27 | @Override | 30 | @Override |
| 28 | protected void onCreate(Bundle savedInstanceState) { | 31 | protected void onCreate(Bundle savedInstanceState) { |
| 29 | super.onCreate(savedInstanceState); | 32 | super.onCreate(savedInstanceState); |
| 30 | binding = DataBindingUtil.setContentView(this, R.layout.activity_conn_bluetooth_success); | 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 | initTopBar(); | 37 | initTopBar(); |
| 32 | initView(); | 38 | initView(); |
| 33 | } | 39 | } |
| @@ -59,6 +65,29 @@ public class ConnBluetoothSuccessActivity extends AppCompatActivity { | @@ -59,6 +65,29 @@ public class ConnBluetoothSuccessActivity extends AppCompatActivity { | ||
| 59 | XiaoJIaCommInfo.setIsShowConnGift(ConnBluetoothSuccessActivity.this, false); | 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 | public void showGift() { | 93 | public void showGift() { |
| @@ -86,7 +115,9 @@ public class ConnBluetoothSuccessActivity extends AppCompatActivity { | @@ -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,6 +4,7 @@ import android.app.Activity; | ||
| 4 | import android.content.Intent; | 4 | import android.content.Intent; |
| 5 | import android.support.v7.app.AppCompatActivity; | 5 | import android.support.v7.app.AppCompatActivity; |
| 6 | import android.os.Bundle; | 6 | import android.os.Bundle; |
| 7 | +import android.text.TextUtils; | ||
| 7 | 8 | ||
| 8 | import com.cnlive.strike.xiaojiaspeaker.R; | 9 | import com.cnlive.strike.xiaojiaspeaker.R; |
| 9 | import com.cnlive.strike.xiaojiaspeaker.ui.fragment.AllDeviceFragment; | 10 | import com.cnlive.strike.xiaojiaspeaker.ui.fragment.AllDeviceFragment; |
| @@ -18,12 +19,19 @@ public class InvitFriendActivity extends AppCompatActivity { | @@ -18,12 +19,19 @@ public class InvitFriendActivity extends AppCompatActivity { | ||
| 18 | protected void onCreate(Bundle savedInstanceState) { | 19 | protected void onCreate(Bundle savedInstanceState) { |
| 19 | super.onCreate(savedInstanceState); | 20 | super.onCreate(savedInstanceState); |
| 20 | setContentView(R.layout.activity_invit_friend); | 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 | Intent intent = new Intent(activity, InvitFriendActivity.class); | 33 | Intent intent = new Intent(activity, InvitFriendActivity.class); |
| 34 | + intent.putExtra("currentSelectFamilyId", currentSelectFamilyId); | ||
| 27 | activity.startActivity(intent); | 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,7 +160,7 @@ public class SelectIMFriendAdapter extends RecyclerView.Adapter { | ||
| 160 | //设置是否选中 | 160 | //设置是否选中 |
| 161 | binding.checkBox.toggle(); | 161 | binding.checkBox.toggle(); |
| 162 | } else { | 162 | } else { |
| 163 | - AlertUtil.showDeftToast(context, "该联系人不可选择"); | 163 | + AlertUtil.showDeftToast(context, "该好友已加入"); |
| 164 | return; | 164 | return; |
| 165 | } | 165 | } |
| 166 | hasSelectMap.put(imFriendInfoList.get(getAdapterPosition()).getId(), binding.checkBox.isChecked()); | 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,6 +3,7 @@ package com.cnlive.strike.xiaojiaspeaker.ui.fragment; | ||
| 3 | import android.os.Bundle; | 3 | import android.os.Bundle; |
| 4 | import android.support.annotation.Nullable; | 4 | import android.support.annotation.Nullable; |
| 5 | import android.support.v4.content.ContextCompat; | 5 | import android.support.v4.content.ContextCompat; |
| 6 | +import android.text.TextUtils; | ||
| 6 | import android.view.View; | 7 | import android.view.View; |
| 7 | 8 | ||
| 8 | import com.cnlive.libs.base.frame.fragment.MvpBindingFragment; | 9 | import com.cnlive.libs.base.frame.fragment.MvpBindingFragment; |
| @@ -38,7 +39,7 @@ public class DeviceDetailFragment extends MvpBindingFragment<DeviceDetailView, D | @@ -38,7 +39,7 @@ public class DeviceDetailFragment extends MvpBindingFragment<DeviceDetailView, D | ||
| 38 | String currentSelectFamilyId = getArguments().getString("currentSelectFamilyId"); | 39 | String currentSelectFamilyId = getArguments().getString("currentSelectFamilyId"); |
| 39 | if (null != getMvpView()) { | 40 | if (null != getMvpView()) { |
| 40 | initTopBar(allDeviceInfo.getName()); | 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,7 +75,19 @@ public class DeviceDetailFragment extends MvpBindingFragment<DeviceDetailView, D | ||
| 74 | public void event(EventMsg msg) { | 75 | public void event(EventMsg msg) { |
| 75 | if (EventMsg.DELETE_DEVICE_NAME_SUCCESS == msg.getEventType()) { | 76 | if (EventMsg.DELETE_DEVICE_NAME_SUCCESS == msg.getEventType()) { |
| 76 | getActivity().finish(); | 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,6 +77,7 @@ public class DeviceManagerFragment extends MvpBindingFragment<DeviceManagerFragm | ||
| 77 | if (null != getMvpView()) { | 77 | if (null != getMvpView()) { |
| 78 | if (null != currentDeviceInfo && !TextUtils.isEmpty(currentDeviceInfo.getMcid())) { | 78 | if (null != currentDeviceInfo && !TextUtils.isEmpty(currentDeviceInfo.getMcid())) { |
| 79 | getPresenter().getDeviceDetailMsg(getActivity(), currentDeviceInfo.getMcid()); | 79 | getPresenter().getDeviceDetailMsg(getActivity(), currentDeviceInfo.getMcid()); |
| 80 | + | ||
| 80 | } | 81 | } |
| 81 | } | 82 | } |
| 82 | } else if (EventMsg.DELETE_DEVICE_NAME_SUCCESS == msg.getEventType()) { | 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,6 +3,7 @@ package com.cnlive.strike.xiaojiaspeaker.ui.fragment; | ||
| 3 | import android.os.Bundle; | 3 | import android.os.Bundle; |
| 4 | import android.support.annotation.Nullable; | 4 | import android.support.annotation.Nullable; |
| 5 | import android.support.v4.content.ContextCompat; | 5 | import android.support.v4.content.ContextCompat; |
| 6 | +import android.text.TextUtils; | ||
| 6 | import android.view.View; | 7 | import android.view.View; |
| 7 | 8 | ||
| 8 | import com.cnlive.libs.base.frame.fragment.MvpBindingFragment; | 9 | import com.cnlive.libs.base.frame.fragment.MvpBindingFragment; |
| @@ -18,8 +19,11 @@ import com.cnlive.strike.xiaojiaspeaker.frame.view.InvitFriendView; | @@ -18,8 +19,11 @@ import com.cnlive.strike.xiaojiaspeaker.frame.view.InvitFriendView; | ||
| 18 | * 二维码邀请加入 | 19 | * 二维码邀请加入 |
| 19 | */ | 20 | */ |
| 20 | public class InvitFriendFragment extends MvpBindingFragment<InvitFriendView, InvitFriendPresenter, Object, FragmentInvitFriendBinding> { | 21 | public class InvitFriendFragment extends MvpBindingFragment<InvitFriendView, InvitFriendPresenter, Object, FragmentInvitFriendBinding> { |
| 21 | - public static InvitFriendFragment newInstance() { | 22 | + public static InvitFriendFragment newInstance(String currentSelectFamilyId) { |
| 22 | InvitFriendFragment fragment = new InvitFriendFragment(); | 23 | InvitFriendFragment fragment = new InvitFriendFragment(); |
| 24 | + Bundle bundle = new Bundle(); | ||
| 25 | + bundle.putString("currentSelectFamilyId", currentSelectFamilyId); | ||
| 26 | + fragment.setArguments(bundle); | ||
| 23 | return fragment; | 27 | return fragment; |
| 24 | } | 28 | } |
| 25 | 29 | ||
| @@ -32,8 +36,15 @@ public class InvitFriendFragment extends MvpBindingFragment<InvitFriendView, Inv | @@ -32,8 +36,15 @@ public class InvitFriendFragment extends MvpBindingFragment<InvitFriendView, Inv | ||
| 32 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | 36 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
| 33 | super.onViewCreated(view, savedInstanceState); | 37 | super.onViewCreated(view, savedInstanceState); |
| 34 | initTopBar(); | 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 | private void initTopBar() { | 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,8 +15,13 @@ import com.cnlive.strike.xiaojiaspeaker.R; | ||
| 15 | import com.cnlive.strike.xiaojiaspeaker.databinding.FragmentSearchDeviceBinding; | 15 | import com.cnlive.strike.xiaojiaspeaker.databinding.FragmentSearchDeviceBinding; |
| 16 | import com.cnlive.strike.xiaojiaspeaker.frame.presenter.SearchDevicefragmentPresenter; | 16 | import com.cnlive.strike.xiaojiaspeaker.frame.presenter.SearchDevicefragmentPresenter; |
| 17 | import com.cnlive.strike.xiaojiaspeaker.frame.view.SearchDevicefragmentView; | 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 | import com.hannesdorfmann.mosby3.mvp.MvpFragment; | 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,6 +37,8 @@ public class SearchDevicefragment extends MvpBindingFragment<SearchDevicefragmen | ||
| 32 | @Override | 37 | @Override |
| 33 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | 38 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
| 34 | super.onViewCreated(view, savedInstanceState); | 39 | super.onViewCreated(view, savedInstanceState); |
| 40 | + EventBusUtil.register(this); | ||
| 41 | + | ||
| 35 | initTopBar(); | 42 | initTopBar(); |
| 36 | initBlueToothScanConfig(); | 43 | initBlueToothScanConfig(); |
| 37 | if (null != getMvpView()) { | 44 | if (null != getMvpView()) { |
| @@ -87,5 +94,13 @@ public class SearchDevicefragment extends MvpBindingFragment<SearchDevicefragmen | @@ -87,5 +94,13 @@ public class SearchDevicefragment extends MvpBindingFragment<SearchDevicefragmen | ||
| 87 | BleManager.getInstance().cancelScan(); | 94 | BleManager.getInstance().cancelScan(); |
| 88 | } catch (Exception e) { | 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,7 +20,12 @@ import com.cnlive.strike.xiaojiaspeaker.R; | ||
| 20 | import com.cnlive.strike.xiaojiaspeaker.databinding.FragmentSelectWifiBinding; | 20 | import com.cnlive.strike.xiaojiaspeaker.databinding.FragmentSelectWifiBinding; |
| 21 | import com.cnlive.strike.xiaojiaspeaker.frame.presenter.SelectWifiFragmentPresenter; | 21 | import com.cnlive.strike.xiaojiaspeaker.frame.presenter.SelectWifiFragmentPresenter; |
| 22 | import com.cnlive.strike.xiaojiaspeaker.frame.view.SelectWifiFragmentView; | 22 | import com.cnlive.strike.xiaojiaspeaker.frame.view.SelectWifiFragmentView; |
| 23 | +import com.cnlive.strike.xiaojiaspeaker.model.message.EventMsg; | ||
| 23 | import com.cnlive.strike.xiaojiaspeaker.netWork.bean.ConfigDeviceNetParam; | 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 | import java.io.Serializable; | 30 | import java.io.Serializable; |
| 26 | 31 | ||
| @@ -50,6 +55,8 @@ public class SelectWifiFragment extends MvpBindingFragment<SelectWifiFragmentVie | @@ -50,6 +55,8 @@ public class SelectWifiFragment extends MvpBindingFragment<SelectWifiFragmentVie | ||
| 50 | @Override | 55 | @Override |
| 51 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | 56 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
| 52 | super.onViewCreated(view, savedInstanceState); | 57 | super.onViewCreated(view, savedInstanceState); |
| 58 | + EventBusUtil.register(this); | ||
| 59 | + | ||
| 53 | initTopBar(); | 60 | initTopBar(); |
| 54 | if (null != getArguments()) { | 61 | if (null != getArguments()) { |
| 55 | BleDevice bleDevice = (BleDevice) getArguments().get("bleDevice"); | 62 | BleDevice bleDevice = (BleDevice) getArguments().get("bleDevice"); |
| @@ -59,12 +66,9 @@ public class SelectWifiFragment extends MvpBindingFragment<SelectWifiFragmentVie | @@ -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 | private void initTopBar() { | 72 | private void initTopBar() { |
| 69 | StatusBarUtil.setStatusBarWrite(getActivity()); | 73 | StatusBarUtil.setStatusBarWrite(getActivity()); |
| 70 | StatusBarUtil2.setColor(getActivity(), ContextCompat.getColor(getActivity(), R.color.white), 0); | 74 | StatusBarUtil2.setColor(getActivity(), ContextCompat.getColor(getActivity(), R.color.white), 0); |
| @@ -94,6 +98,7 @@ public class SelectWifiFragment extends MvpBindingFragment<SelectWifiFragmentVie | @@ -94,6 +98,7 @@ public class SelectWifiFragment extends MvpBindingFragment<SelectWifiFragmentVie | ||
| 94 | @Override | 98 | @Override |
| 95 | public void onDestroy() { | 99 | public void onDestroy() { |
| 96 | super.onDestroy(); | 100 | super.onDestroy(); |
| 101 | + EventBusUtil.unRegister(this); | ||
| 97 | if (null != mBroadcastReceiver) { | 102 | if (null != mBroadcastReceiver) { |
| 98 | getActivity().unregisterReceiver(mBroadcastReceiver); | 103 | getActivity().unregisterReceiver(mBroadcastReceiver); |
| 99 | } | 104 | } |
| @@ -120,4 +125,11 @@ public class SelectWifiFragment extends MvpBindingFragment<SelectWifiFragmentVie | @@ -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,12 +50,12 @@ public class UserManagerFragment extends MvpBindingFragment<UserManagerView, Use | ||
| 50 | if (null != getMvpView()) { | 50 | if (null != getMvpView()) { |
| 51 | if (null != currentSelectFamilyId) { | 51 | if (null != currentSelectFamilyId) { |
| 52 | getMvpView().setCurrentSelectFamily(currentSelectFamilyId); | 52 | getMvpView().setCurrentSelectFamily(currentSelectFamilyId); |
| 53 | + getPresenter().getFamilyRole(getActivity(), XiaoJIaCommInfo.getUserId(getActivity()), currentSelectFamilyId, XiaoJIaCommInfo.getUserPhone(getActivity())); | ||
| 53 | } | 54 | } |
| 54 | getMvpView().initPopView(); | 55 | getMvpView().initPopView(); |
| 55 | // getMvpView().initView(null); | 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,7 +21,7 @@ | ||
| 21 | android:layout_height="50dp" | 21 | android:layout_height="50dp" |
| 22 | android:layout_marginTop="10dp" | 22 | android:layout_marginTop="10dp" |
| 23 | android:layout_marginBottom="10dp" | 23 | android:layout_marginBottom="10dp" |
| 24 | - android:background="@drawable/selectable_item_white" | 24 | + android:background="@color/white" |
| 25 | android:clickable="true"> | 25 | android:clickable="true"> |
| 26 | 26 | ||
| 27 | <LinearLayout | 27 | <LinearLayout |
| @@ -78,7 +78,7 @@ | @@ -78,7 +78,7 @@ | ||
| 78 | android:layout_height="50dp" | 78 | android:layout_height="50dp" |
| 79 | android:layout_marginTop="10dp" | 79 | android:layout_marginTop="10dp" |
| 80 | android:layout_marginBottom="10dp" | 80 | android:layout_marginBottom="10dp" |
| 81 | - android:background="@drawable/selectable_item_white" | 81 | + android:background="@color/white" |
| 82 | android:clickable="true"> | 82 | android:clickable="true"> |
| 83 | 83 | ||
| 84 | <LinearLayout | 84 | <LinearLayout |
| @@ -134,7 +134,7 @@ | @@ -134,7 +134,7 @@ | ||
| 134 | android:layout_height="50dp" | 134 | android:layout_height="50dp" |
| 135 | android:layout_marginTop="10dp" | 135 | android:layout_marginTop="10dp" |
| 136 | android:layout_marginBottom="10dp" | 136 | android:layout_marginBottom="10dp" |
| 137 | - android:background="@drawable/selectable_item_white" | 137 | + android:background="@color/white" |
| 138 | android:clickable="true"> | 138 | android:clickable="true"> |
| 139 | 139 | ||
| 140 | <LinearLayout | 140 | <LinearLayout |
module_xiaojiaSoundBox/src/main/res/layout/activity_share_friend.xml
| @@ -87,7 +87,7 @@ | @@ -87,7 +87,7 @@ | ||
| 87 | <TextView | 87 | <TextView |
| 88 | android:layout_width="15dp" | 88 | android:layout_width="15dp" |
| 89 | android:layout_height="15dp" | 89 | android:layout_height="15dp" |
| 90 | - android:background="@drawable/shape_green_circle" | 90 | + android:background="@drawable/shape_xiaojia_green_circle" |
| 91 | android:gravity="center" | 91 | android:gravity="center" |
| 92 | android:text="1" | 92 | android:text="1" |
| 93 | android:textColor="@color/white" | 93 | android:textColor="@color/white" |
| @@ -107,7 +107,7 @@ | @@ -107,7 +107,7 @@ | ||
| 107 | <TextView | 107 | <TextView |
| 108 | android:layout_width="15dp" | 108 | android:layout_width="15dp" |
| 109 | android:layout_height="15dp" | 109 | android:layout_height="15dp" |
| 110 | - android:background="@drawable/shape_green_circle" | 110 | + android:background="@drawable/shape_xiaojia_green_circle" |
| 111 | android:gravity="center" | 111 | android:gravity="center" |
| 112 | android:text="2" | 112 | android:text="2" |
| 113 | android:textColor="@color/white" | 113 | android:textColor="@color/white" |
| @@ -127,7 +127,7 @@ | @@ -127,7 +127,7 @@ | ||
| 127 | <TextView | 127 | <TextView |
| 128 | android:layout_width="15dp" | 128 | android:layout_width="15dp" |
| 129 | android:layout_height="15dp" | 129 | android:layout_height="15dp" |
| 130 | - android:background="@drawable/shape_green_circle" | 130 | + android:background="@drawable/shape_xiaojia_green_circle" |
| 131 | android:gravity="center" | 131 | android:gravity="center" |
| 132 | android:text="3" | 132 | android:text="3" |
| 133 | android:textColor="@color/white" | 133 | android:textColor="@color/white" |
module_xiaojiaSoundBox/src/main/res/layout/fragment_select_im_friend.xml
| @@ -60,8 +60,7 @@ | @@ -60,8 +60,7 @@ | ||
| 60 | <android.support.v7.widget.RecyclerView | 60 | <android.support.v7.widget.RecyclerView |
| 61 | android:id="@+id/rv_friends" | 61 | android:id="@+id/rv_friends" |
| 62 | android:layout_width="match_parent" | 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 | <com.cnlive.strike.ui.widget.LetterBarView | 65 | <com.cnlive.strike.ui.widget.LetterBarView |
| 67 | android:id="@+id/letterBarView" | 66 | android:id="@+id/letterBarView" |
| @@ -80,7 +79,10 @@ | @@ -80,7 +79,10 @@ | ||
| 80 | android:id="@+id/btn_next" | 79 | android:id="@+id/btn_next" |
| 81 | android:layout_width="match_parent" | 80 | android:layout_width="match_parent" |
| 82 | android:layout_height="45dp" | 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 | android:background="@drawable/selector_btn_green" | 86 | android:background="@drawable/selector_btn_green" |
| 85 | android:text="下一步" | 87 | android:text="下一步" |
| 86 | android:textColor="@color/white" | 88 | android:textColor="@color/white" |
module_xiaojiaSoundBox/src/main/res/layout/fragment_user_manager.xml
| @@ -12,6 +12,7 @@ | @@ -12,6 +12,7 @@ | ||
| 12 | android:layout_height="?attr/qmui_topbar_height" /> | 12 | android:layout_height="?attr/qmui_topbar_height" /> |
| 13 | 13 | ||
| 14 | <FrameLayout | 14 | <FrameLayout |
| 15 | + android:id="@+id/fl_close_view" | ||
| 15 | android:layout_width="match_parent" | 16 | android:layout_width="match_parent" |
| 16 | android:layout_height="45dp" | 17 | android:layout_height="45dp" |
| 17 | android:background="@color/color_F7B054"> | 18 | android:background="@color/color_F7B054"> |
| @@ -25,6 +26,7 @@ | @@ -25,6 +26,7 @@ | ||
| 25 | android:textSize="14sp" /> | 26 | android:textSize="14sp" /> |
| 26 | 27 | ||
| 27 | <LinearLayout | 28 | <LinearLayout |
| 29 | + android:id="@+id/ll_close_tip" | ||
| 28 | android:layout_width="wrap_content" | 30 | android:layout_width="wrap_content" |
| 29 | android:layout_height="match_parent" | 31 | android:layout_height="match_parent" |
| 30 | android:layout_gravity="right" | 32 | android:layout_gravity="right" |