Commit 51ab099b472cfea51aa36efe72ac6acf366d755d
1 parent
666ed4ee
1 优化基类传值逻辑
Showing
27 changed files
with
67 additions
and
75 deletions
cloud/user/src/main/java/com/cnlive/strike/user/ui/activity/FirstLoginActivity.java
| ... | ... | @@ -23,8 +23,8 @@ public class FirstLoginActivity extends BaseActivity { |
| 23 | 23 | |
| 24 | 24 | |
| 25 | 25 | @Override |
| 26 | - protected void initParam(Intent params) { | |
| 27 | - super.initParam(params); | |
| 26 | + protected void initParams(Intent params) { | |
| 27 | + super.initParams(params); | |
| 28 | 28 | tagMsg = params.getStringExtra(LoginActivity.TAG_MSG); |
| 29 | 29 | boolean clickAd = params.getBooleanExtra(TAG_CLICK_AD, false); |
| 30 | 30 | firstLoginFragment = new FirstLoginFragment(); | ... | ... |
cloud/user/src/main/java/com/cnlive/strike/user/ui/activity/LoginActivity.java
| ... | ... | @@ -6,7 +6,6 @@ import android.content.Intent; |
| 6 | 6 | import android.net.Uri; |
| 7 | 7 | |
| 8 | 8 | import androidx.annotation.NonNull; |
| 9 | -import androidx.appcompat.app.AppCompatActivity; | |
| 10 | 9 | |
| 11 | 10 | import com.alibaba.android.arouter.facade.annotation.Route; |
| 12 | 11 | import com.cnlive.core.libs.base.frame.activity.BaseActivity; |
| ... | ... | @@ -69,8 +68,8 @@ public class LoginActivity extends BaseActivity { |
| 69 | 68 | } |
| 70 | 69 | |
| 71 | 70 | @Override |
| 72 | - protected void initParam(Intent params) { | |
| 73 | - super.initParam(params); | |
| 71 | + protected void initParams(Intent params) { | |
| 72 | + super.initParams(params); | |
| 74 | 73 | fromTokenError = params.getBooleanExtra(FROM_TOKEN_ERROR, false); |
| 75 | 74 | tagMsg = params.getStringExtra(TAG_MSG) == null ? "" : params.getStringExtra(TAG_MSG); |
| 76 | 75 | shareType = params.getStringExtra(TAG_SHARE); | ... | ... |
cloud/user/src/main/java/com/cnlive/strike/user/ui/activity/UpdateContentActivity.java
| ... | ... | @@ -69,8 +69,8 @@ public class UpdateContentActivity extends BaseActivity implements View.OnClickL |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | @Override |
| 72 | - protected void initParam(Intent params) { | |
| 73 | - super.initParam(params); | |
| 72 | + protected void initParams(Intent params) { | |
| 73 | + super.initParams(params); | |
| 74 | 74 | type = getIntent().getStringExtra("type"); |
| 75 | 75 | } |
| 76 | 76 | ... | ... |
cloud/user/src/main/java/com/cnlive/strike/user/ui/fragment/FirstLoginFragment.java
| ... | ... | @@ -62,12 +62,9 @@ public class FirstLoginFragment extends BaseFragment<FirstLoginView, FirstLoginP |
| 62 | 62 | |
| 63 | 63 | |
| 64 | 64 | @Override |
| 65 | - protected void initParams() { | |
| 66 | - super.initParams(); | |
| 67 | - if (getArguments() != null) { | |
| 68 | - tagMsg = getArguments().getString(LoginActivity.TAG_MSG); | |
| 69 | - clickAd = getArguments().getBoolean(FirstLoginActivity.TAG_CLICK_AD); | |
| 70 | - } | |
| 65 | + protected void initParams(Bundle params) { | |
| 66 | + tagMsg = params.getString(LoginActivity.TAG_MSG); | |
| 67 | + clickAd = params.getBoolean(FirstLoginActivity.TAG_CLICK_AD); | |
| 71 | 68 | } |
| 72 | 69 | |
| 73 | 70 | @Override | ... | ... |
cloud/user/src/main/java/com/cnlive/strike/user/ui/fragment/QuickLoginFragment.java
| ... | ... | @@ -80,15 +80,13 @@ public class QuickLoginFragment extends BaseFragment<QuickLoginView, QuickLoginP |
| 80 | 80 | showDefaultWhiteStatusBar(); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | + | |
| 83 | 84 | @Override |
| 84 | - protected void initParams() { | |
| 85 | - super.initParams(); | |
| 86 | - if (getArguments() != null) { | |
| 87 | - fromTokenError = getArguments().getBoolean(LoginActivity.FROM_TOKEN_ERROR, false); | |
| 88 | - tagMsg = getArguments().getString(LoginActivity.TAG_MSG); | |
| 89 | - tagShare = getArguments().getString(LoginActivity.TAG_SHARE); | |
| 90 | - clickAd = getArguments().getBoolean(LoginActivity.TAG_CLICK_AD); | |
| 91 | - } | |
| 85 | + protected void initParams(Bundle params) { | |
| 86 | + fromTokenError = params.getBoolean(LoginActivity.FROM_TOKEN_ERROR, false); | |
| 87 | + tagMsg = params.getString(LoginActivity.TAG_MSG); | |
| 88 | + tagShare = params.getString(LoginActivity.TAG_SHARE); | |
| 89 | + clickAd = params.getBoolean(LoginActivity.TAG_CLICK_AD); | |
| 92 | 90 | uri = UserAction.getUri(getActivity()); |
| 93 | 91 | } |
| 94 | 92 | ... | ... |
core/app_qr/src/main/java/com/cnlive/strike/moudle/qr/ui/activity/ScanZarBarActivity.java
| ... | ... | @@ -110,7 +110,7 @@ public class ScanZarBarActivity extends BaseActivity<ScanNewView, ScanNewPresent |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | @Override |
| 113 | - protected void initParam(Intent params) { | |
| 113 | + protected void initParams(Intent params) { | |
| 114 | 114 | type = params.getStringExtra("where"); |
| 115 | 115 | } |
| 116 | 116 | ... | ... |
core/app_qr/src/main/java/com/cnlive/strike/moudle/qr/ui/fragment/QrPayFragment.java
| ... | ... | @@ -58,9 +58,10 @@ public class QrPayFragment extends BaseFragment<QrPayView, QrPayPresenter> imple |
| 58 | 58 | binding = (FragmentQrPayBinding) baseBinding; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | + | |
| 61 | 62 | @Override |
| 62 | - protected void initParams() { | |
| 63 | - dareId = getArguments().getString(tag_darenId); | |
| 63 | + protected void initParams(Bundle params) { | |
| 64 | + dareId = params.getString(tag_darenId); | |
| 64 | 65 | } |
| 65 | 66 | |
| 66 | 67 | @Override | ... | ... |
core/app_qr/src/main/java/com/cnlive/strike/moudle/qr/ui/fragment/QrSignInFragment.java
| ... | ... | @@ -49,9 +49,9 @@ public class QrSignInFragment extends BaseFragment<QrSignInView, QrSignInPresent |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | @Override |
| 52 | - protected void initParams() { | |
| 53 | - message = getArguments() == null ? null : (String) getArguments().getString("msg"); | |
| 54 | - type = getArguments() == null ? null : (String) getArguments().getString("type"); | |
| 52 | + protected void initParams(Bundle params) { | |
| 53 | + message = params.getString("msg"); | |
| 54 | + type = params.getString("type"); | |
| 55 | 55 | if (TextUtils.isEmpty(message) || TextUtils.isEmpty(type)) { |
| 56 | 56 | AlertUtil.showDeftToast(getActivity(), "加载信息有误."); |
| 57 | 57 | getActivity().finish(); |
| ... | ... | @@ -59,7 +59,6 @@ public class QrSignInFragment extends BaseFragment<QrSignInView, QrSignInPresent |
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - | |
| 63 | 62 | @Override |
| 64 | 63 | protected void initView() { |
| 65 | 64 | binding.tvMessage.setText(message); | ... | ... |
core/base/src/main/java/com/cnlive/core/libs/base/frame/activity/BaseActivity.java
| ... | ... | @@ -38,7 +38,6 @@ import androidx.databinding.DataBindingUtil; |
| 38 | 38 | import androidx.databinding.ViewDataBinding; |
| 39 | 39 | import androidx.fragment.app.Fragment; |
| 40 | 40 | |
| 41 | -import com.alibaba.android.arouter.facade.annotation.Autowired; | |
| 42 | 41 | import com.alibaba.android.arouter.launcher.ARouter; |
| 43 | 42 | import com.cnlive.core.libs.base.application.AppConfig; |
| 44 | 43 | import com.cnlive.core.libs.base.frame.fragment.BaseFragment; |
| ... | ... | @@ -165,7 +164,7 @@ public abstract class BaseActivity<V extends BaseView, P extends BasePresenter<V |
| 165 | 164 | initBindingLayoutData(baseBinding); |
| 166 | 165 | } |
| 167 | 166 | if (null != getIntent()) { |
| 168 | - initParam(getIntent()); | |
| 167 | + initParams(getIntent()); | |
| 169 | 168 | } |
| 170 | 169 | //初始化控件 |
| 171 | 170 | initView(); |
| ... | ... | @@ -280,7 +279,7 @@ public abstract class BaseActivity<V extends BaseView, P extends BasePresenter<V |
| 280 | 279 | protected void init(@Nullable Bundle savedInstanceState) { |
| 281 | 280 | } |
| 282 | 281 | |
| 283 | - protected void initParam(Intent params) { | |
| 282 | + protected void initParams(Intent params) { | |
| 284 | 283 | } |
| 285 | 284 | |
| 286 | 285 | /** | ... | ... |
core/base/src/main/java/com/cnlive/core/libs/base/frame/fragment/BaseFragment.java
| ... | ... | @@ -92,7 +92,9 @@ public abstract class BaseFragment<V extends BaseView, P extends BasePresenter<V |
| 92 | 92 | setSwipeBackEnable(me.isOpenSwipBack()); |
| 93 | 93 | ARouter.getInstance().inject(this); |
| 94 | 94 | init(savedInstanceState); |
| 95 | - initParams(); | |
| 95 | + if (null!=getArguments()){ | |
| 96 | + initParams(getArguments()); | |
| 97 | + } | |
| 96 | 98 | } |
| 97 | 99 | |
| 98 | 100 | @Nullable |
| ... | ... | @@ -279,7 +281,7 @@ public abstract class BaseFragment<V extends BaseView, P extends BasePresenter<V |
| 279 | 281 | /** |
| 280 | 282 | * 在初始化视图之前做的事 |
| 281 | 283 | */ |
| 282 | - protected void initParams() { | |
| 284 | + protected void initParams(Bundle params) { | |
| 283 | 285 | |
| 284 | 286 | } |
| 285 | 287 | ... | ... |
core/imageload/src/main/java/com/cnlive/core/imageload/preview/PreviewImgFragment.java
| ... | ... | @@ -47,10 +47,11 @@ public class PreviewImgFragment extends BaseFragment<PreviewImgView, PreviewImgP |
| 47 | 47 | |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | + | |
| 50 | 51 | @Override |
| 51 | - protected void initParams() { | |
| 52 | - super.initParams(); | |
| 53 | - previewData = (ImagePreviewShowInfo) getArguments().getSerializable("data"); | |
| 52 | + protected void initParams(Bundle params) { | |
| 53 | + previewData = (ImagePreviewShowInfo) params.getSerializable("data"); | |
| 54 | + | |
| 54 | 55 | } |
| 55 | 56 | |
| 56 | 57 | @Override |
| ... | ... | @@ -62,6 +63,6 @@ public class PreviewImgFragment extends BaseFragment<PreviewImgView, PreviewImgP |
| 62 | 63 | public void onDestroy() { |
| 63 | 64 | super.onDestroy(); |
| 64 | 65 | Glide.with(this).onDestroy(); |
| 65 | - if (getMvpView()!=null)getMvpView().timerCancel(); | |
| 66 | + if (getMvpView() != null) getMvpView().timerCancel(); | |
| 66 | 67 | } |
| 67 | 68 | } | ... | ... |
module/pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/CollPedometerMainActivity.java
| ... | ... | @@ -36,7 +36,7 @@ public class CollPedometerMainActivity extends BaseActivity { |
| 36 | 36 | private RunRaceDetailInfo runRaceDetailInfo; |
| 37 | 37 | |
| 38 | 38 | @Override |
| 39 | - protected void initParam(Intent params) { | |
| 39 | + protected void initParams(Intent params) { | |
| 40 | 40 | runRaceDetailInfo = (RunRaceDetailInfo) params.getSerializableExtra("runRaceDetailInfo"); |
| 41 | 41 | } |
| 42 | 42 | ... | ... |
module/pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/StartCollectTraceActivity.java
| ... | ... | @@ -39,7 +39,7 @@ public class StartCollectTraceActivity extends BaseActivity { |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | @Override |
| 42 | - protected void initParam(Intent params) { | |
| 42 | + protected void initParams(Intent params) { | |
| 43 | 43 | runRaceDetailInfo = (RunRaceDetailInfo) params.getSerializableExtra("runRaceDetailInfo"); |
| 44 | 44 | } |
| 45 | 45 | ... | ... |
module/pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/activity/RunLineActivity.java
| ... | ... | @@ -30,7 +30,7 @@ public class RunLineActivity extends BaseActivity { |
| 30 | 30 | |
| 31 | 31 | |
| 32 | 32 | @Override |
| 33 | - protected void initParam(Intent params) { | |
| 33 | + protected void initParams(Intent params) { | |
| 34 | 34 | if (!TextUtils.isEmpty(params.getStringExtra("userId"))) { |
| 35 | 35 | CommonInfo.setUserId(this, params.getStringExtra("userId")); |
| 36 | 36 | CommonInfo.setUserNickName(this, params.getStringExtra("userName")); | ... | ... |
module/pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/activity/RunRaceDetailActivity.java
| ... | ... | @@ -48,7 +48,7 @@ public class RunRaceDetailActivity extends BaseActivity { |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | @Override |
| 51 | - protected void initParam(Intent params) { | |
| 51 | + protected void initParams(Intent params) { | |
| 52 | 52 | if (params.getStringExtra("eventId") != null) { |
| 53 | 53 | eventId = params.getStringExtra("eventId"); |
| 54 | 54 | } | ... | ... |
module/pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/activity/SelfRecordActivity.java
| ... | ... | @@ -27,7 +27,7 @@ public class SelfRecordActivity extends BaseActivity { |
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | @Override |
| 30 | - protected void initParam(Intent params) { | |
| 30 | + protected void initParams(Intent params) { | |
| 31 | 31 | if (params.getStringExtra("userId") != null) { |
| 32 | 32 | CommonInfo.setUserId(this, params.getStringExtra("userId")); |
| 33 | 33 | CommonInfo.setUserNickName(this, params.getStringExtra("userName")); | ... | ... |
module/pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/activity/ShareRecordActivity.java
| ... | ... | @@ -72,7 +72,7 @@ public class ShareRecordActivity extends BaseActivity { |
| 72 | 72 | |
| 73 | 73 | |
| 74 | 74 | @Override |
| 75 | - protected void initParam(Intent params) { | |
| 75 | + protected void initParams(Intent params) { | |
| 76 | 76 | if (params.getStringExtra("idName") != null) |
| 77 | 77 | idName = params.getStringExtra("idName"); |
| 78 | 78 | } | ... | ... |
module/pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/MyRecordFragment.java
| ... | ... | @@ -46,10 +46,11 @@ public class MyRecordFragment extends BaseFragment<MyRecordView, MyRecordPresent |
| 46 | 46 | |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | + | |
| 49 | 50 | @Override |
| 50 | - protected void initParams() { | |
| 51 | - super.initParams(); | |
| 52 | - state = getArguments().getString("state"); | |
| 51 | + protected void initParams(Bundle params) { | |
| 52 | + state = params.getString("state"); | |
| 53 | + | |
| 53 | 54 | } |
| 54 | 55 | |
| 55 | 56 | @Override | ... | ... |
module/pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RaceRecorFragment.java
| ... | ... | @@ -43,10 +43,10 @@ public class RaceRecorFragment extends BaseFragment<RaceRecorView, RaceRecorPres |
| 43 | 43 | |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | + | |
| 46 | 47 | @Override |
| 47 | - protected void initParams() { | |
| 48 | - super.initParams(); | |
| 49 | - raceTitle = getArguments().getString("raceTitle"); | |
| 48 | + protected void initParams(Bundle params) { | |
| 49 | + raceTitle = params.getString("raceTitle"); | |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | @Override | ... | ... |
module/pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RegistrationInfoFragment.java
| ... | ... | @@ -59,16 +59,14 @@ public class RegistrationInfoFragment extends BaseFragment<RegistrationInfoView, |
| 59 | 59 | @Override |
| 60 | 60 | protected void initBindingLayoutData(ViewDataBinding baseBinding) { |
| 61 | 61 | super.initBindingLayoutData(baseBinding); |
| 62 | - binding = (FragmentRegistrationInfoBinding)baseBinding; | |
| 62 | + binding = (FragmentRegistrationInfoBinding) baseBinding; | |
| 63 | 63 | |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | + | |
| 66 | 67 | @Override |
| 67 | - protected void initParams() { | |
| 68 | - super.initParams(); | |
| 69 | - if (null != getArguments()) { | |
| 70 | - fenceId = getArguments().getString("fenceId"); | |
| 71 | - } | |
| 68 | + protected void initParams(Bundle params) { | |
| 69 | + fenceId = params.getString("fenceId"); | |
| 72 | 70 | } |
| 73 | 71 | |
| 74 | 72 | @Override | ... | ... |
module/pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RunMainFragment.java
| ... | ... | @@ -68,12 +68,11 @@ public class RunMainFragment extends BaseFragment<RunMainFragmentView, BasePrese |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | @Override |
| 71 | - protected void initParams() { | |
| 72 | - super.initParams(); | |
| 71 | + protected void initParams(Bundle params) { | |
| 73 | 72 | EventBus.getDefault().register(this); |
| 74 | 73 | if (getArguments() != null) { |
| 75 | 74 | initTipDialog(); |
| 76 | - runRaceDetailInfo = (RunRaceDetailInfo) getArguments().getSerializable("runRaceDetailInfo"); | |
| 75 | + runRaceDetailInfo = (RunRaceDetailInfo)params.getSerializable("runRaceDetailInfo"); | |
| 77 | 76 | UserStepEntity userStepEntity = StepUtil.getUserStepData(getActivity(), CommonInfo.getUserId(getActivity())); |
| 78 | 77 | if (userStepEntity != null) { |
| 79 | 78 | if (runRaceDetailInfo != null) { | ... | ... |
module/pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RunningFinishFragment.java
| ... | ... | @@ -37,17 +37,15 @@ public class RunningFinishFragment extends BaseFragment<RunningFinishFragmentVie |
| 37 | 37 | @Override |
| 38 | 38 | protected void initBindingLayoutData(ViewDataBinding baseBinding) { |
| 39 | 39 | super.initBindingLayoutData(baseBinding); |
| 40 | - binding = (FragmentFinishRunMapBinding)baseBinding; | |
| 40 | + binding = (FragmentFinishRunMapBinding) baseBinding; | |
| 41 | 41 | |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | + | |
| 44 | 45 | @Override |
| 45 | - protected void initParams() { | |
| 46 | - super.initParams(); | |
| 47 | - if (getArguments() != null) { | |
| 48 | - runningFinishBean = (RunningFinishBean) getArguments().getSerializable("runningFinishBean"); | |
| 46 | + protected void initParams(Bundle params) { | |
| 47 | + runningFinishBean = (RunningFinishBean) params.getSerializable("runningFinishBean"); | |
| 49 | 48 | |
| 50 | - } | |
| 51 | 49 | } |
| 52 | 50 | |
| 53 | 51 | @Override | ... | ... |
module/pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/TakePartFragment.java
| 1 | 1 | package com.cnlive.moudle.pedometer.ui.fragment; |
| 2 | 2 | |
| 3 | 3 | |
| 4 | +import android.os.Bundle; | |
| 5 | + | |
| 4 | 6 | import androidx.databinding.ViewDataBinding; |
| 5 | 7 | |
| 6 | 8 | import com.cnlive.core.libs.base.frame.fragment.BaseFragment; |
| ... | ... | @@ -32,14 +34,11 @@ public class TakePartFragment extends BaseFragment<TakePartView, TakePartPresent |
| 32 | 34 | |
| 33 | 35 | } |
| 34 | 36 | |
| 35 | - @Override | |
| 36 | - protected void initParams() { | |
| 37 | - super.initParams(); | |
| 38 | - eventID = CommonInfo.getStreetId(getActivity()); | |
| 39 | - } | |
| 37 | + | |
| 40 | 38 | |
| 41 | 39 | @Override |
| 42 | 40 | protected void initView() { |
| 41 | + eventID = CommonInfo.getStreetId(getActivity()); | |
| 43 | 42 | getPresenter().setData(getActivity(), eventID, currentPage, itemNum); |
| 44 | 43 | if (getMvpView() != null) getMvpView().initView(); |
| 45 | 44 | binding.refreshLayout.setOnRefreshListener(v -> { | ... | ... |
module/xiaojiasoundbox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/activity/ConnBluetoothSuccessActivity.java
| ... | ... | @@ -45,7 +45,7 @@ public class ConnBluetoothSuccessActivity extends BaseActivity { |
| 45 | 45 | |
| 46 | 46 | |
| 47 | 47 | @Override |
| 48 | - protected void initParam(Intent params) { | |
| 48 | + protected void initParams(Intent params) { | |
| 49 | 49 | networkResultBean = (NetworkResultBean) params.getSerializableExtra("networkResultBean"); |
| 50 | 50 | |
| 51 | 51 | } | ... | ... |
module/xiaojiasoundbox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/activity/ConnFailActivity.java
| ... | ... | @@ -30,7 +30,7 @@ public class ConnFailActivity extends BaseActivity { |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | @Override |
| 33 | - protected void initParam(Intent params) { | |
| 33 | + protected void initParams(Intent params) { | |
| 34 | 34 | phone = params.getStringExtra("phone"); |
| 35 | 35 | if (!TextUtils.isEmpty(phone)) { |
| 36 | 36 | binding.tvTip.setText("该设备已被" + phone + "绑定"); | ... | ... |
module/xiaojiasoundbox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/activity/SelectWifiActivity.java
| ... | ... | @@ -30,9 +30,11 @@ public class SelectWifiActivity extends BaseActivity { |
| 30 | 30 | |
| 31 | 31 | @Override |
| 32 | 32 | protected void initView() { |
| 33 | - bleDevice = (BleDevice) getIntent().getSerializableExtra("bleDevice"); | |
| 33 | + bleDevice = (BleDevice) getIntent().getParcelableExtra("bleDevice"); | |
| 34 | 34 | wifiUtils = new WifiUtils(this); |
| 35 | - loadRootFragment(R.id.root_container, SelectWifiFragment.newInstance(bleDevice)); | |
| 35 | + if (null != bleDevice) { | |
| 36 | + loadRootFragment(R.id.root_container, SelectWifiFragment.newInstance(bleDevice)); | |
| 37 | + } | |
| 36 | 38 | } |
| 37 | 39 | |
| 38 | 40 | ... | ... |
module/xiaojiasoundbox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/fragment/SelectWifiFragment.java
| ... | ... | @@ -60,7 +60,7 @@ public class SelectWifiFragment extends BaseFragment<SelectWifiFragmentView, Sel |
| 60 | 60 | |
| 61 | 61 | initTopBar(); |
| 62 | 62 | if (null != getArguments()) { |
| 63 | - BleDevice bleDevice = (BleDevice) getArguments().get("bleDevice"); | |
| 63 | + BleDevice bleDevice = (BleDevice) getArguments().getParcelable("bleDevice"); | |
| 64 | 64 | if (null != getMvpView() && null != bleDevice) { |
| 65 | 65 | getMvpView().initWifiList(bleDevice); |
| 66 | 66 | registerBroadcast(); |
| ... | ... | @@ -69,7 +69,6 @@ public class SelectWifiFragment extends BaseFragment<SelectWifiFragmentView, Sel |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | |
| 72 | - | |
| 73 | 72 | private void initTopBar() { |
| 74 | 73 | if (null != binding) { |
| 75 | 74 | binding.topbar.setTitle("请选择WIFI网络").setTextColor(ContextCompat.getColor(getActivity(), R.color.color_282828)); | ... | ... |