package com.hh.arome.ui.setting;

import android.view.View;
import android.widget.ImageButton;
import android.widget.TextView;

import com.hh.arome.R;
import com.hh.arome.bean.DeviceConfigResultBean;
import com.hh.arome.common.ConfigData;
import com.hh.arome.ui.base.BaseHHActivity;
import com.hh.arome.utlis.device.DeviceUtils;

public class BaseInfoActivity extends BaseHHActivity {
    @Override
    public int setLayout() {
        return R.layout.activity_base_info;
    }

    TextView tv_sn_value,
            tv_ampe_value,
            tv_server_name_value,
            tv_user_library_value,
            tv_scene_value, tv_mode_value,
            tv_package_name_value,
            tv_ip_address_value,
            tv_app_version_value;

    TextView tv_title_center;
    ImageButton iv_title_left;

    @Override
    protected void initView() {
        super.initView();

        tv_title_center = findViewById(R.id.tv_title_center);
        iv_title_left = findViewById(R.id.iv_title_left);

        tv_sn_value = findViewById(R.id.tv_sn_value);
        tv_ampe_value = findViewById(R.id.tv_ampe_value);
        tv_server_name_value = findViewById(R.id.tv_server_name_value);
        tv_user_library_value = findViewById(R.id.tv_user_library_value);
        tv_scene_value = findViewById(R.id.tv_scene_value);
        tv_mode_value = findViewById(R.id.tv_mode_value);
        tv_package_name_value = findViewById(R.id.tv_package_name_value);
        tv_ip_address_value = findViewById(R.id.tv_ip_address_value);
        tv_app_version_value = findViewById(R.id.tv_app_version_value);


    }

    @Override
    protected void initData() {

        tv_title_center.setText("设置");

        tv_sn_value.setText(DeviceUtils.getDeviceSN());

        DeviceConfigResultBean deviceConfigResultBean = ConfigData.getDeviceConfigResultBean();
        if(deviceConfigResultBean!=null){

            tv_ampe_value.setText(deviceConfigResultBean.getAmpeName());
            tv_server_name_value.setText(deviceConfigResultBean.getTenantName());
            tv_user_library_value.setText(deviceConfigResultBean.getUserLibName());
            tv_scene_value.setText(deviceConfigResultBean.getSceneName());
            tv_mode_value.setText(deviceConfigResultBean.getMode());
            tv_package_name_value.setText(DeviceUtils.getAppPackageName(this));
            tv_ip_address_value.setText(DeviceUtils.getDeviceIP());
            tv_app_version_value.setText(DeviceUtils.getAppVersionName(this));
        }



//        ConfigData.getDeviceConfigResultBean().setAgeForbidText();


    }

    @Override
    protected void initListener() {
        iv_title_left.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
    }
}
