xuxiuxi
2017-05-05 55e3f5761aae3dca19b0e417c05043d718891af0
VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/fragment/DeviceFragment.java
@@ -1,5 +1,6 @@
package cn.com.basic.face.fragment;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.view.LayoutInflater;
@@ -55,6 +56,11 @@
    @ViewInject(R.id.fragment_left_right_frame_layout_right)
    private FrameLayout fragment_left_right_frame_layout_right;
    @ViewInject(R.id.fragment_device_right_camera1_brand)
    private EditText fragment_device_right_camera1_brand;
    @ViewInject(R.id.fragment_device_right_camera1_ip)
    private EditText fragment_device_right_camera1_ip;
    private View wifiView;
    private View lanView;
    private View schoolView;
@@ -67,17 +73,28 @@
        fragment_device_left_school_check_box.setChecked(false);
        fragment_device_left_camera1_check_box.setChecked(false);
        fragment_device_left_camera2_check_box.setChecked(false);
        fragment_left_right_frame_layout_right.removeAllViews();
    }
    @Override
    protected void initViews(View view, Bundle savedInstanceState) {
        super.initViews(view, savedInstanceState);
        wifiView = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_device_right_wifi, null);
        lanView = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_device_right_lan, null);
        schoolView = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_device_right_school, null);
        camera1View = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_device_right_camera1, null);
        camera2View = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_device_right_camera2, null);
        ViewUtils.inject(this, wifiView);
        ViewUtils.inject(this, lanView);
        ViewUtils.inject(this, schoolView);
        ViewUtils.inject(this, camera1View);
        ViewUtils.inject(this, camera2View);
    }
    @OnClick(R.id.fragment_device_left_wifi_check_box)
    public void fragment_device_left_wifi_check_box_click(View view) {
        clearAll();
        fragment_device_left_wifi_check_box.setChecked(true);
        fragment_left_right_frame_layout_right.removeAllViews();
        if (wifiView == null) {
            wifiView = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_device_right_wifi, null);
        }
        fragment_left_right_frame_layout_right.addView(wifiView);
    }
@@ -85,11 +102,6 @@
    public void fragment_device_left_lan_check_box_click(View view) {
        clearAll();
        fragment_device_left_lan_check_box.setChecked(true);
        fragment_left_right_frame_layout_right.removeAllViews();
        if (lanView == null) {
            lanView = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_device_right_lan, null);
        }
        fragment_left_right_frame_layout_right.addView(lanView);
    }
@@ -97,11 +109,6 @@
    public void fragment_device_left_school_check_box_click(View view) {
        clearAll();
        fragment_device_left_school_check_box.setChecked(true);
        fragment_left_right_frame_layout_right.removeAllViews();
        if (schoolView == null) {
            schoolView = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_device_right_school, null);
        }
        fragment_left_right_frame_layout_right.addView(schoolView);
    }
@@ -109,11 +116,6 @@
    public void fragment_device_left_camera1_check_box_click(View view) {
        clearAll();
        fragment_device_left_camera1_check_box.setChecked(true);
        fragment_left_right_frame_layout_right.removeAllViews();
        if (camera1View == null) {
            camera1View = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_device_right_camera1, null);
        }
        fragment_left_right_frame_layout_right.addView(camera1View);
    }
@@ -121,11 +123,6 @@
    public void fragment_device_left_camera2_check_box_click(View view) {
        clearAll();
        fragment_device_left_camera2_check_box.setChecked(true);
        fragment_left_right_frame_layout_right.removeAllViews();
        if (camera2View == null) {
            camera2View = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_device_right_camera2, null);
        }
        fragment_left_right_frame_layout_right.addView(camera2View);
    }