111
hxb
2022-11-24 0a3e07f10937484145f33c7560607b4b2353cb81
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package com.mm.android.deviceaddmodule.p_devicelocal;
 
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentManager;
import android.text.TextUtils;
import android.view.View;
 
import com.mm.android.deviceaddmodule.R;
import com.mm.android.deviceaddmodule.base.BaseTipFragment;
import com.mm.android.deviceaddmodule.event.DeviceAddEvent;
import com.mm.android.deviceaddmodule.helper.DeviceAddHelper;
import com.mm.android.deviceaddmodule.helper.DeviceAddImageLoaderHelper;
import com.mm.android.deviceaddmodule.mobilecommon.AppConsume.ProviderManager;
import com.mm.android.deviceaddmodule.mobilecommon.entity.deviceadd.DeviceAddInfo;
import com.mm.android.deviceaddmodule.mobilecommon.entity.deviceadd.DeviceIntroductionInfo;
import com.mm.android.deviceaddmodule.model.DeviceAddModel;
import com.nostra13.universalimageloader.core.ImageLoader;
 
import org.greenrobot.eventbus.EventBus;
 
/**
 * 设备本地配网
 */
public class TipDeviceLocalFragment extends BaseTipFragment {
 
    public static TipDeviceLocalFragment newInstance() {
        TipDeviceLocalFragment fragment = new TipDeviceLocalFragment();
        Bundle args = new Bundle();
        fragment.setArguments(args);
        return fragment;
    }
 
    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        DeviceAddHelper.updateTile(DeviceAddHelper.TitleMode.MORE);
    }
 
    @Override
    protected void initView(View view) {
        super.initView(view);
        DeviceAddHelper.updateTile(DeviceAddHelper.TitleMode.MORE);
 
        mConfirmCheck.setVisibility(View.GONE);
        mNextBtn.setVisibility(View.VISIBLE);
        mNextBtn.setText(R.string.common_confirm);
    }
 
    @Override
    protected void initData() {
        super.initData();
        DeviceAddInfo deviceAddInfo= DeviceAddModel.newInstance().getDeviceInfoCache();
        DeviceIntroductionInfo deviceIntroductionInfo = deviceAddInfo.getDevIntroductionInfo();
        if (deviceIntroductionInfo != null) {
            String tipImage = deviceIntroductionInfo.getImageInfos().get(DeviceAddHelper.OMSKey.LOCATION_MODE_OPERATION_IMAGE);
            String tipTxt = deviceIntroductionInfo.getStrInfos().get(DeviceAddHelper.OMSKey.LOCATION_MODE_OPERATION_INTRODUCTION);
            if (!TextUtils.isEmpty(tipImage)) {
                ImageLoader.getInstance().displayImage(tipImage, mTipImg,
                        DeviceAddImageLoaderHelper.getCommonOptions());
            }
            if (!TextUtils.isEmpty(tipTxt)) {
                mTipTxt.setText(tipTxt);
 
            }
        }
    }
 
    @Override
    protected void nextAction() {
        if (getActivity() != null) {
            if (DeviceAddModel.newInstance().getDeviceInfoCache().isWifiOfflineMode()
                    || DeviceAddInfo.DeviceAddType.HUB.equals(DeviceAddModel.newInstance().getDeviceInfoCache().getCurDeviceAddType())) {
                ProviderManager.getDeviceAddCustomProvider().goHomePage(getActivity());//离线配网模式,跳转到主页
            } else {
                getActivity().getSupportFragmentManager().popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
            }
            EventBus.getDefault().post(new DeviceAddEvent(DeviceAddEvent.DESTROY_ACTION));
        }
    }
 
    @Override
    protected void helpAction() {
 
    }
 
    @Override
    protected void init() {
        initView(mView);
        initData();
    }
}