package com.hh.arome.activity.setting;

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

import androidx.annotation.Nullable;
import androidx.appcompat.widget.Toolbar;

import com.hh.arome.R;
import com.hh.arome.utils.UIUtils;

import com.hh.lib_base.ConfigData;
import com.hh.lib_base.Constants;
import com.hh.lib_base.activity.BaseActivity;
import com.hh.lib_base.bean.device.DeviceConfigResultBean;
import com.hh.lib_base.log.AppLogUtils;
import com.hh.lib_base.utils.device.DeviceUtils;

public class PushActivity extends BaseActivity implements View.OnClickListener {

    private ImageButton iv_title_left;
    private TextView tv_title_center;
    private Toolbar tb_center;
    private TextView tv_confirm;
    private TextView tv_device_push_url;

    private String deviceModel ;
    private TextView tv_log_push_url;
    private DeviceConfigResultBean deviceConfigBean;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        deviceModel = DeviceUtils.getDeviceModel();
        super.onCreate(savedInstanceState);
    }

    @Override
    protected int getLayoutId() {
        if(Constants.DeviceModel.D2.equals(deviceModel)) {
            return R.layout.activity_push_hp;
        }else{
            return R.layout.activity_push;

        }
    }



    @Override
    protected void initView() {
        iv_title_left = findViewById(R.id.iv_title_left);
        tv_title_center = findViewById(R.id.tv_title_center);
        tb_center = findViewById(R.id.tb_center);
        tv_confirm = findViewById(R.id.tv_confirm);
        iv_title_left.setOnClickListener(this);
        tv_confirm.setOnClickListener(this);
        tv_device_push_url = findViewById(R.id.tv_device_push_url);
        tv_log_push_url = findViewById(R.id.tv_log_push_url);
    }



    @Override
    protected void initData() {

        tv_title_center.setText("推送地址配置");

        deviceConfigBean = ConfigData.getDeviceConfigResultBean();

        if (deviceConfigBean == null) {
            AppLogUtils.e("deviceConfigBean == null");
            deviceConfigBean = new DeviceConfigResultBean();
        }

        String heartTrackingUrl = deviceConfigBean.getHeartTrackingUrl();
        AppLogUtils.e("heartTrackingUrl--"+heartTrackingUrl);
        UIUtils.setText(tv_device_push_url,heartTrackingUrl);


        String logPushUrl = deviceConfigBean.getLogPushUrl();
        AppLogUtils.e("logPushUrl--"+logPushUrl);
        UIUtils.setText(tv_log_push_url,logPushUrl);


    }

    @Override
    protected void initEvent() {

    }

    @Override
    public void onClick(View var1) {
        switch (var1.getId()) {
            case R.id.iv_title_left:
                finish();
                break;
            case R.id.tv_confirm:
                break;
        }
    }


}
