public void updateAlarm() {
   alarmBtn.setBackgroundResource(R.drawable.button_alarm);
   List<Alarm> alarms = getSiteAlarms();
   for (Alarm alarm : alarms) {
     if (alarm.getAlarmSite().equals(site.getSiteName())) {
       alarmBtn.setBackgroundResource(R.drawable.button_alarm_red);
       break;
     }
   }
 }
  private void initViews(View parentView) {
    tvTitle = (TextView) parentView.findViewById(R.id.user_main_title);
    if (site != null) {
      tvTitle.setText(site.getSiteName());
    }
    logoffBtn = (ImageButton) parentView.findViewById(R.id.btn_logoff);
    logoffBtn.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View arg0) {
            logoff();
          }
        });

    alarmBtn = (ImageButton) parentView.findViewById(R.id.btn_alarm);
    alarmBtn.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            showAlarmList();
          }
        });
    updateAlarm();

    detailBtn = (ImageButton) parentView.findViewById(R.id.btn_detail);
    detailBtn.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View arg0) {
            showSiteDetail();
          }
        });

    tvInfo = (TextView) parentView.findViewById(R.id.user_main_info);

    llCo2Panel = (LinearLayout) parentView.findViewById(R.id.co2_panel);
    llCo2IconPanel = (LinearLayout) parentView.findViewById(R.id.co2_icon_panel);
    ivCo2Icon = (ImageView) parentView.findViewById(R.id.co2_icon);
    tvCo2Caption = (TextView) parentView.findViewById(R.id.co2_caption);
    tvCo2Value = (TextView) parentView.findViewById(R.id.co2_value);
    tvCo2Unit = (TextView) parentView.findViewById(R.id.co2_unit);

    tvCo2Value.setTypeface(null, Typeface.BOLD);

    llTemperaturePanel = (LinearLayout) parentView.findViewById(R.id.temperature_panel);
    llTemperatureIconPanel = (LinearLayout) parentView.findViewById(R.id.temperature_icon_panel);
    ivTemperatureIcon = (ImageView) parentView.findViewById(R.id.temperature_icon);
    tvTemperatureCaption = (TextView) parentView.findViewById(R.id.temperature_caption);
    tvTemperatureValue = (TextView) parentView.findViewById(R.id.temperature_value);
    tvTemperatureUnit = (TextView) parentView.findViewById(R.id.temperature_unit);

    tvTemperatureValue.setTypeface(null, Typeface.BOLD);

    llHumidityPanel = (LinearLayout) parentView.findViewById(R.id.humidity_panel);
    llHumidityIconPanel = (LinearLayout) parentView.findViewById(R.id.humidity_icon_panel);
    ivHumidityIcon = (ImageView) parentView.findViewById(R.id.humidity_icon);
    tvHumidityCaption = (TextView) parentView.findViewById(R.id.humidity_caption);
    tvHumidityValue = (TextView) parentView.findViewById(R.id.humidity_value);
    tvHumidityUnit = (TextView) parentView.findViewById(R.id.humidity_unit);

    tvHumidityValue.setTypeface(null, Typeface.BOLD);
  }